// **************************************************************************** // // ** ** // // ** Package : cToolTip.pkg ** // // ** ** // // ** Class : cToolTip ** // // ** ** // // ** Author : Ulbe Stellema ** // // ** Data Access Nederland ** // // ** ** // // ** Date : januari 16, 2001 ** // // ** ** // // ** Purpose : Wrapper class for MicroSoft tooltip controls ** // // ** ** // // **************************************************************************** // // $Rev History // januari 16, 2001 Module header created // // december 3, 2001 Nils G. Svedmyr // Added new property "piWidth 350" The width of a tooltip text in pixels. // When max width is exceeded the text will get wrapped onto the next line. // Added Set Window_Style To TTS_NOPREFIX True. Will strip ampersands from // the tooltip text. // Set baloon tooltip style to true. // Added "Use cWinctrol.pkg" // **************************************************************************** // Use Commctrl.pkg Use cWincontrol.pkg Use cWinToolTip.h // Tooltip messages //Define TTM_ACTIVATE For WM_USER+1) //Define TTM_SETDELAYTIME For (WM_USER+3) //Define TTM_ADDTOOL for (WM_USER+4) //Define TTM_ADDTOOLW For (WM_USER+50) //Define TTM_DELTOOL for (WM_USER+5) //Define TTM_NEWTOOLRECT for (WM_USER+6) //Define TTM_RELAYEVENT for (WM_USER+7) //Define TTM_GETTOOLINFO for (WM_USER+8) //Define TTM_SETTOOLINFO for (WM_USER+9) //Define TTM_HITTEST for (WM_USER+10) //Define TTM_GETTEXT for (WM_USER+11) //Define TTM_UPDATETIPTEXT for (WM_USER+12) //Define TTM_GETTOOLCOUNT for (WM_USER+13) //Define TTM_ENUMTOOLS for (WM_USER+14) //Define TTM_GETCURRENTTOOL for (WM_USER+15) //Define TTM_WINDOWFROMPOINT for (WM_USER+16) //Define TTM_TRACKACTIVATE for (WM_USER+17) //Define TTM_TRACKPOSITION for (WM_USER+18) //Define TTM_SETTIPBKCOLOR for (WM_USER+19) //Define TTM_SETTIPTEXTCOLOR for (WM_USER+20) //Define TTM_GETDELAYTIME for (WM_USER+21) //Define TTM_GETTIPBKCOLOR for (WM_USER+22) //Define TTM_GETTIPTEXTCOLOR for (WM_USER+23) //Define TTM_SETMAXTIPWIDTH for (WM_USER+24) //Define TTM_GETMAXTIPWIDTH for (WM_USER+25) //Define TTM_SETMARGIN for (WM_USER+26) //Define TTM_GETMARGIN for (WM_USER+27) //Define TTM_POP for (WM_USER+28) //Define TTM_UPDATE for (WM_USER+29) // Tooltip styles //Define TTS_ALWAYSTIP for |CI$01 //Define TTS_NOPREFIX for |CI$02 //Define TTS_NOANIMATE for |CI$10 //Define TTS_NOFADE for |CI$20 //Define TTS_BALLOON for |CI$40 // Tooltip flags //Define TTF_IDISHWND for |CI$0001 //Define TTF_CENTERTIP for |CI$0002 //Define TTF_RTLREADING for |CI$0004 //Define TTF_SUBCLASS for |CI$0010 //Define TTF_TRACK for |CI$0020 //Define TTF_ABSOLUTE for |CI$0080 //Define TTF_TRANSPARENT for |CI$0100 //Define TTF_DI_SETITEM for |CI$8000 //Type TOOLINFO // Field TOOLINFO.cbSize as Integer // Field TOOLINFO.uFlags as Integer // Field TOOLINFO.hwnd as Handle // Field TOOLINFO.uId as Integer // Field TOOLINFO.rect.left as Integer // Field TOOLINFO.rect.top as Integer // Field TOOLINFO.rect.right as Integer // Field TOOLINFO.rect.bottom as Integer // Field TOOLINFO.hinst as Handle // Field TOOLINFO.lpszText as Pointer // Field TOOLINFO.lParam as Integer //End_Type // TOOLINFO //Use Dfextclm.pkg // External class mixin, used for focus synchronisation Class cTooltip Is A cWinControl Procedure Construct_Object Boolean bState // 2004-04-26 ------------------------------------ Start Nils G. Svedmyr Forward Send Construct_Object Set External_Class_Name "DFTooltip" To "Tooltips_class32" // 2004-04-26 ------------------------------------ Stop Nils G. Svedmyr Property String psTooltip // 2002-12-03 ------------------------------------ Start Nils G. Svedmyr Property Integer piWidth 350 // Maximum width in pixels. Will devide the text in multiple lines. Set Window_Style To TTS_NOPREFIX True // Strips ampersands from the string. Set Window_Style To TTS_BALLOON True // 2002-12-03 ------------------------------------ Stop Nils G. Svedmyr Set Window_Style To WS_POPUP True Set Window_Style To TTS_ALWAYSTIP True End_Procedure // Construct_Object Procedure AddTool Handle hWindow String sToolInfo sText Get psToolTip To sText ZeroType tTOOLINFO To sToolInfo Put tTOOLINFO_Size To sToolInfo at tTOOLINFO.cbSize Put (TTF_SUBCLASS iOr TTF_IDISHWND) To sToolInfo at tTOOLINFO.uFlags Put (Window_Handle(Self)) To sToolInfo at tTOOLINFO.hwnd Put hWindow To sToolInfo at tTOOLINFO.uId Put (AddressOf(sText)) To sToolInfo at tTOOLINFO.lpszText Put Self To sToolInfo at tTOOLINFO.lParam Move (SendMessage(Window_Handle(Self),TTM_ADDTOOL,0,AddressOf(sToolInfo))) To WindowIndex // 2002-12-03 ------------------------------------ Start Nils G. Svedmyr Move (SendMessage(Window_Handle(Self),TTM_SETMAXTIPWIDTH,0,piWidth(Self))) To WindowIndex Set Focus_Mode To NonFocusable // _Must_ be placed here! // 2002-12-03 ------------------------------------ Stop Nils G. Svedmyr End_Procedure // AddTool // 2003-05-12 ------------------------------------ Start Nils G. Svedmyr Procedure Destroy Send DeleteTool Forward Send Destroy End_Procedure // Destroy // 2003-05-12 ------------------------------------ Stop Nils G. Svedmyr // 2004-05-11 ------------------------------------ Start Nils G. Svedmyr Procedure RefreshToolTip Local Integer iRet iRemoveTip Local String sTipText Get psTooltip To sTipText If (Trim(sTipText)) Eq "" Move 1 To iRemoveTip If iRemoveTip Begin Move (SendMessage((Self),TTM_POP,0,0)) To iRet Procedure_Return End Move (Sendmessage((Self),TTM_UPDATE,0,0)) To iRet Move (Sendmessage((Self),TTM_UPDATETIPTEXT,0,0)) To iRet End_Procedure // 2004-05-11 ------------------------------------ Stop Nils G. Svedmyr Procedure DeleteTool String sToolInfo Handle hWindow Get Window_Handle Of (Parent(Self)) To hWindow ZeroType tTOOLINFO To sToolInfo Put tTOOLINFO_Size To sToolInfo at tTOOLINFO.cbSize Put (Window_Handle(Self)) To sToolInfo at tTOOLINFO.hwnd Put hWindow To sToolInfo at tTOOLINFO.uId Move (SendMessage(Window_Handle(Self),TTM_DELTOOL,0,AddressOf(sToolInfo))) To WindowIndex End_Procedure // DeleteTool End_Class // cTooltip