?? n_tooltip.sru
字號:
Integer ai_Flags Tool creation flags
Use: Call from mousemove-event for control
******************************************************************************/
TOOLINFO ToolInfo
Integer li_Width, li_Height
ToolInfo.cbSize = 40
ToolInfo.uFlags = TTF_SUBCLASS //Flags
ToolInfo.hWnd = Handle( ado_Object )
ToolInfo.hInstance= 0 // Not used
ToolInfo.uID = ToolID
iul_Handle[ToolID] = ToolInfo.hWnd
ToolID++
ToolInfo.lpszText = LocalAlloc( 0, 120 )
POST LocalFree( ToolInfo.lpszText ) // Free Allocated Memory
lStrCpy( ToolInfo.lpszText, Left( as_tiptext, 120 ) )
// Define the object as a rectangle
ToolInfo.Rect.Left = 0
ToolInfo.Rect.Top = 0
ToolInfo.Rect.Right = UnitsToPixels( ado_Object.Width, XUnitsToPixels! )
ToolInfo.Rect.Bottom = UnitsToPixels( ado_Object.Height, YUnitsToPixels! )
If ToolTipMsg( hWndTT, TTM_ADDTOOL, 0, ToolInfo ) = 0 Then
MessageBox( "Error", "Cannot register object in the toolwindow control!", StopSign!, Ok! )
Return( -1 )
End If
Return ( ToolID - 1 )
end function
public function long of_getfont ();/*****************************************************************************
Function: of_getfont
Description: Gets the font used in the tooltip window
Returns: (none)
Arguments:
Use: Call from mousemove-event for control
******************************************************************************/
uLong lul_Font
lul_Font = Send( hWndTT, WM_GETFONT, 0, 0 )
Return lul_Font
end function
public subroutine of_relaymsg (dragobject ado_object);/*****************************************************************************
Function: of_relaymsg
Description: This function will send the control message to the
toolwindow control.
Returns: (none)
Arguments: DragObject ado_Object
Use: Call from mousemove-event for control
******************************************************************************/
MSG Msg
Msg.hWnd = Handle( ado_Object )
Msg.WParam = Message.WordParm
Msg.LParam = Message.LongParm
RelayMsg( hWndTT, TTM_RELAYEVENT, 0, Msg )
end subroutine
public subroutine of_setmaxwidth (long al_maxwidth);/*****************************************************************************
Function: of_setmaxwidth
Description: Sets the maximum tooltip width. If the text is longer it will
splitted over more than one line.
Returns: (none)
Arguments: Long al_MaxWidth
Use: Call to set the maximum width.
-------------------------------------------------------------------------------
Auteur: Aart Onkenhout
Revision History
--------------------
Date Version
15-05-2000 1.0 Initial version
******************************************************************************/
Send( hWndTT, TTM_SETMAXTIPWIDTH, 0, UnitsToPixels( al_MaxWidth, xUnitsToPixels! ) )
Return
end subroutine
public function integer of_removetool (dragobject ado_object, integer ai_toolid);/*****************************************************************************
Function: of_removetool
Description: Unregisters a control within the tooltip control
Returns: (none)
Arguments: DragObject ado_Object Object to unregister within the tooltip control
Integer ai_ToolId Tool Id (returned by of_AddTool)
Use:
-------------------------------------------------------------------------------
Auteur: Aart Onkenhout
Revision History
--------------------
Date Version
29-06-2001 1.0 Initial version
******************************************************************************/
TOOLINFO ToolInfo
Integer li_Width, li_Height
ToolInfo.cbSize = 40
ToolInfo.uFlags = 16 //Flags
ToolInfo.hWnd = Handle( ado_Object )
ToolInfo.hInstance= 0 // Not used
ToolInfo.uID = ai_ToolID
iul_Handle[ToolID] = ToolInfo.hWnd
ToolTipMsg( hWndTT, TTM_DELTOOL, 0, ToolInfo )
Return 1
end function
public subroutine of_settiptitle (integer ai_icon, string as_title);/*****************************************************************************
Function: of_settiptitle
Description: Sets the title of the tooltip
Returns: (none)
Arguments: Integer ai_Icon
Values: TTI_NONE = 0
TTI_INFO = 1
TTI_WARNING = 2
TTI_ERROR = 3
String as_Title
Use: Call with the desired title and icon.
-------------------------------------------------------------------------------
Auteur: Aart Onkenhout
Revision History
--------------------
Date Version
10-05-2001 1.0 Initial version
******************************************************************************/
SendMessageString( hWndTT, TTM_SETTITLEA, ai_Icon, as_Title )
end subroutine
public subroutine of_settiptextcolor (long aul_color);/*****************************************************************************
Function: of_settiptextcolor
Description: Sets the textcolor
Returns: (none)
Arguments: uLong aul_Color
Use: Call with the desired color
-------------------------------------------------------------------------------
Auteur: Aart Onkenhout
Revision History
--------------------
Date Version
10-05-2001 1.0 Initial version
******************************************************************************/
Send( hWndTT, TTM_SETTIPTEXTCOLOR, aul_Color, 0 )
end subroutine
public subroutine of_settipbkcolor (long aul_color);/*****************************************************************************
Function: of_settipbkcolor
Description: Sets the backgroundcolor of the tooltip-window
Returns: (none)
Arguments: uLong aul_Color
Use: Call with the desired color
-------------------------------------------------------------------------------
Auteur: Aart Onkenhout
Revision History
--------------------
Date Version
10-05-2001 1.0 Initial version
******************************************************************************/
Send( hWndTT, TTM_SETTIPBKCOLOR,aul_color, 0 )
end subroutine
public function integer of_controlregister (dragobject controlobject, integer tipstyle, string tip, integer title, string titlename, integer maxwidth, long bkcolor, long textcolor);
if hWndTT<=0 then
if TIPSTYLE = 0 then
hWndTT = CreateWindowExA(WS_EX_TOPMOST,TOOLTIPS_CLASS,0, TTF_CENTERTIP + TTS_BALLOON + 2, &
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, &
0, 0, Handle(GetApplication()),0)
else
HWndTT = CreateWindowExA(WS_EX_TOPMOST, TOOLTIPS_CLASS,0,TTF_CENTERTIP, &
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, &
0, 0, Handle(GetApplication()),0)
end if
end if
of_SetMaxWidth( MaxWidth)
of_SetTipBKColor( BKColor)
of_SetTipTextColor( TextColor)
of_SetTipTitle( title, titlename )
// Register Controls...
TOOLINFO ToolInfo
Integer li_Width, li_Height
ToolInfo.cbSize = 40
ToolInfo.uFlags = TTF_SUBCLASS //Flags
ToolInfo.hWnd = Handle(controlobject)
ToolInfo.hInstance= 0 // Not used
ToolInfo.uID = ToolID
iul_Handle[ToolID] = ToolInfo.hWnd
ToolID++
ToolInfo.lpszText = LocalAlloc( 0, 120 )
POST LocalFree( ToolInfo.lpszText ) // Free Allocated Memory
lStrCpy( ToolInfo.lpszText, Left( tip, 120 ) )
// Define the object as a rectangle
ToolInfo.Rect.Left = 0
ToolInfo.Rect.Top = 0
ToolInfo.Rect.Right = UnitsToPixels( controlobject.Width, XUnitsToPixels! )
ToolInfo.Rect.Bottom = UnitsToPixels( controlobject.Height, YUnitsToPixels! )
If ToolTipMsg( hWndTT, TTM_ADDTOOL, 1, ToolInfo ) = 0 Then
MessageBox( "Error", "Cannot register object in the toolwindow control!", StopSign!, Ok! )
Return( -1 )
End If
Return ( ToolID - 1 )
end function
on n_tooltip.create
call super::create
TriggerEvent( this, "constructor" )
end on
on n_tooltip.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on
event constructor;InitCommonControls()
//
//hWndTT = CreateWindowExA(WS_EX_TOPMOST,TOOLTIPS_CLASS,0, TTF_CENTERTIP + TTS_BALLOON + 1, &
// CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, &
// 0, 0, Handle(GetApplication()),0)
//
end event
event destructor;DestroyWindow(hWndTT)
end event
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -