Please can somebody give me a pointer (no pun intended) on the code
below. I've created a dialog with tooltips that works fine with
both DDT buttons and a static button created with CreateWindowEx.
If I click on one of my buttons I create a child dialog with a
second static button, again the tooltip works fine.
If I remove the comment to make the static window have the style
%WS_CHILD then the tooltips fail to work. Can anybody explain this
for me? I'm sure that there are several other ways of doing this
but this is just a small example of part of a major project and
i'm not sure that I could change the way that project is written -
he who pays the bills has designed it that way! I've also noticed
that the parent dialog's tooltips don't work when the child is
displayed - any way of getting them to work.
Does anybody want to guess at how many posts are going to appear
about "The Announcement" we all received?
Regards
Nick
------------------
below. I've created a dialog with tooltips that works fine with
both DDT buttons and a static button created with CreateWindowEx.
If I click on one of my buttons I create a child dialog with a
second static button, again the tooltip works fine.
If I remove the comment to make the static window have the style
%WS_CHILD then the tooltips fail to work. Can anybody explain this
for me? I'm sure that there are several other ways of doing this
but this is just a small example of part of a major project and
i'm not sure that I could change the way that project is written -
he who pays the bills has designed it that way! I've also noticed
that the parent dialog's tooltips don't work when the child is
displayed - any way of getting them to work.
Does anybody want to guess at how many posts are going to appear
about "The Announcement" we all received?

Regards
Nick
Code:
#Compile Exe #Include "win32api.inc" #Include "commctrl.inc Global hChild As Long Global hDlg As Long Global hTTip As Long Global hInstance As Long Declare Function ShowChild() As Long '=====================/ Enumeration callback /================================= Function EnumChildProc(ByVal CtrlDlg As Long, param As Long) As Long Local lTI As TOOLINFO, lZStr As Asciiz * 128 GetClassName CtrlDlg, lzStr, SizeOf(lzStr) If lzStr <> "STATIC" Then lTI.cbSize = SizeOf(lTI) lTI.uFlags = %TTF_IDISHWND Or %TTF_SUBCLASS lTI.hwnd = hDlg lTI.uID = CtrlDlg lTI.hInst = hInstance lTI.lpszText= %LPSTR_TEXTCALLBACK SendMessage hTTip, %TTM_ADDTOOL, 0, VarPtr(lTI) End If Function = 1 End Function '============================================================================== Function AddToolTips (ByVal hDlg As Long) As Long hTTip = CreateWindowEx (0, _ "tooltips_class32", _ ByVal %NULL, _ %WS_POPUP Or %TTS_ALWAYSTIP, _ %CW_USEDEFAULT, _ %CW_USEDEFAULT, _ %CW_USEDEFAULT, _ %CW_USEDEFAULT, _ ByVal hDlg, _ ByVal %NULL, _ GetWindowLong (hDlg, %GWL_HINSTANCE), _ ByVal %NULL) If hTTip = %FALSE Then Function = 0 : Exit Function If (EnumChildWindows (hDlg, CodePtr(EnumChildProc), 0)) = 0 Then Function = %FALSE Else Function = %TRUE End If End Function '============================================================================== CallBack Function MainCb() As Long Local lTTptr As TOOLTIPTEXT Ptr, lZStr As Asciiz * 64 If CbCtl = 104 Then ShowChild Exit Function ElseIf CbCtl = 105 Then Dialog End hChild Exit Function End If Select Case CbMsg Case %WM_NOTIFY lTTPtr = CbLparam If @lTTPtr.Hdr.Code = %TTN_NEEDTEXT Then lZStr = Time$ @lTTPtr.lpszText = VarPtr(lZStr) End If End Select End Function '============================================================================== Function WinMain (ByVal CurInst&, ByVal PrvInst&, CmdLine As Asciiz Ptr, _ ByVal CmdShow&) Export As Long Local lRet As Long hInstance = CurInst& InitCommonControls Dialog New 0, "ToolTip",,,320,240,%WS_OVERLAPPED Or %WS_SYSMENU To hDlg Control Add Button, hDlg,101,"Button #1",10,10,40,14,%WS_TABSTOP ID%=102 Style&=%WS_CHILD Or %WS_VISIBLE Or %WS_DLGFRAME Or %SS_NOTIFY hCTL& = CreateWindowEx(0,"STATIC","Static"+Chr$(0),Style&,15,50,60,24,hDlg,ID%,hInstance,ByVal %NULL) Control Add Button, hDlg,104,"Show Child",270,206,40,14,%WS_TABSTOP Control Handle hDlg,101 To lRet AddToolTips hDlg Dialog Show Modal hDlg Call MainCb End Function '============================================================================== Function ShowChild() As Long 'Style&=%WS_CHILD Dialog New hDlg,"", 60, 60, 260, 180, Style& To hChild ID%=105 Style&=%WS_CHILD Or %WS_VISIBLE Or %WS_DLGFRAME Or %SS_BITMAP Or %SS_CENTERIMAGE Or %SS_NOTIFY hCTL& = CreateWindowEx(0,"STATIC","Q-STRING"+Chr$(0),Style&,20,20,50,50,hChild,ID%,hInstance,ByVal %NULL) AddToolTips hChild Dialog Show Modal hChild Call MainCb End Function
------------------
Comment