Semen, I tried your example and it works nice. Thanks.
I'll be studying it now to figure out how it works.
------------------
Bernard Ertl
Announcement
Collapse
No announcement yet.
Context sensitive help?
Collapse
X
-
Well, I'm calling the dialog with:
DIALOG SHOW MODELESS hDlg&
and :
DO
DIALOG DOEVENTS
'more code...
CONTROL GET CHECK hDlg&, %IDEXITBOX TO Dummy1&
'%IDEXITBOX is invisible & set by other buttons
LOOP UNTIL Dummy1&
So, I don't have a callback function for the dialog.
The PB DOCs say that the %DS_CONTEXTHELP for the dialog sends the %WM_HELP to the control which the user clicks on. But my control is not receiving one...
If I creat a callback for the dialog and it is receiving the %WM_HELP messages, how would I know which control was clicked?
'**************************
If you use SetWindowContextHelpId(..) to set appropriate id for
control vs help file section, right after control has been
created, you can trap this id in dialog's %WM_HELP and show
proper help file popup. Simple sample:
'**************************
I'm not sure (yet) what you mean by control vs. help file section. I was attempting to capture the %WM_HELP message in control's callback and then display a simple MSGBOX message. Are you saying there is an easy way to interface with a windows .HLP file?
Bernard Ertl
------------------
Leave a comment:
-
DDT doesn't give access to original callback.
Unlike WM_HELP really occurs in real callback for button (see a sample), in SaveButton you will not receive it.
Code:#Compile Exe #Dim All #Register None #Include "WIN32API.INC" Global gOldProc As Long CallBack Function SubClassProc Select Case CbMsg Case %WM_HELP Dim lphi As HELPINFO Ptr lphi = CbLparam MsgBox "Id = " & Str$(@lphi.iCtrlId), , "WM_HELP from SubClassProc" Function = 1: Exit Function End Select Function = CallWindowProc(gOldProc, CbHndl, CbMsg, CbWparam, CbLparam) End Function CallBack Function DlgProc Select Case CbMsg Case %WM_HELP Dim lphi As HELPINFO Ptr lphi = CbLparam MsgBox "Id = " & Str$(@lphi.iCtrlId), , "WM_HELP from DlgProc" Function = 1: Exit Function End Select End Function Function PbMain Local hDlg As Long Dialog New 0, "Context Help",,, 240, 180, %WS_CAPTION Or %WS_SYSMENU Or %DS_CONTEXTHELP, To hDlg Control Add Button, hDlg, %IDOK, "&Ok", 190, 10, 40, 14 gOldProc = SetWindowLong (GetDlgItem(hDlg, %IDOK), %GWL_WNDPROC, CodePtr(SubClassProc)) Control Add TextBox, hDlg, 102, "", 10, 30, 170, 130, _ %ES_MULTILINE Or %ES_WANTRETURN Or %WS_TABSTOP, %WS_EX_CLIENTEDGE Dialog Show Modal hDlg Call DlgProc End Function
E-MAIL: [email protected]
Leave a comment:
-
The message is probably sent to the dialog's callback function.
If you use SetWindowContextHelpId(..) to set appropriate id for
control vs help file section, right after control has been
created, you can trap this id in dialog's %WM_HELP and show
proper help file popup. Simple sample:
Code:'¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' Simple help context sample '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ #COMPILE EXE #INCLUDE "WIN32API.INC" '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' Main callback '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ CALLBACK FUNCTION DlgProc() AS LONG SELECT CASE CBMSG CASE %WM_COMMAND IF CBCTL = 1 THEN DIALOG END CBHNDL, 1 '<- exit CASE %WM_HELP LOCAL hi AS HELPINFO PTR hi = CBLPARAM MSGBOX STR$(@hi.dwContextId) 'return 5, as set END SELECT END FUNCTION '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ ' Create dialog and controls, etc '¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤ FUNCTION PBMAIN () AS LONG LOCAL hDlg AS LONG DIALOG NEW 0, "Help Context test ",,, 150, 50, %WS_SYSMENU OR %DS_CONTEXTHELP, 0 TO hDlg CONTROL ADD BUTTON, hDlg, 1, "E&xit", 50, 10, 50, 14, 1 CALL SetWindowContextHelpId(GetDlgItem(hDlg, 1), 5) 'set id to 5, just for test DIALOG SHOW MODAL hDlg CALL DlgProc END FUNCTION
Leave a comment:
-
Context sensitive help?
I'm trying to enable context sensitive help in a dialog with DDT. I've created the dialog using :
DIALOG NEW 0, Title$, ,, 300, 200, %DS_CONTEXTHELP OR %WS_CAPTION OR %WS_SYSMENU TO hDlg&
CONTROL ADD BUTTON, hDlg&, %IDSAVE, "Save / &Exit", _
150, 170, 60, 14, _
%BS_NOTIFY OR %BS_CENTER OR %BS_VCENTER OR %WS_TABSTOP CALL SaveButton
The dialog displays the ? box and the user can click on it and carry the arrow w/? mouse pointer to the Save button, but my callback function SaveButton is not receiving any messages (I was expecting %WM_HELP) when the user clicks on button. What have I done wrong (or am I missing)?
Bernard Ertl
------------------
Tags: None
Leave a comment: