Semen
Thanks for the input to this problem. I was discussing DIALOG END with Lance and after I modded the program along the lines he suggested and recomped, I no longer have this behavoural problem.
Don't know what changed specifically.
regards
Barney
------------------
Announcement
Collapse
No announcement yet.
DDT and the Keyboard accelerators
Collapse
X
-
Guest replied
-
Ok, Barney --
This is a peace of Address.Bas, which I reconstructed some weeks ago to see technique exactly (excuse me, Lance)
Because you wrote about ALT-N, ALT-Y, I changed "hot keys" in former "Find" procedure.
So, test : ALT-C - appears sub-dialog
then ALT-Y or ALT - N
Code:#Compile Exe #Register None #Dim All #Include "WIN32API.INC" $AppTitle = "Address Book - PB/DLL 6.0 DDT Example" %ID_COMMENTS = 115 %ID_COND = 125 %ID_DELETE = 126 %ID_MENU_CLOSE = %IDCANCEL %ID_MENU_HELP = 204 %ID_MENU_ABOUT = 205 Global ghDlg As Long CallBack Function OkCallBack Dialog End CbHndl, 1 End Function CallBack Function CancelCallBack Dialog End CbHndl, 0 End Function CallBack Function AddressCallBack Local hDlg As Long Select Case CbMsg Case %WM_COMMAND Select Case CbCtl Case %id_Menu_About Dialog New ghDlg, $AppTitle, 0, 0, 150, 60, _ %DS_MODALFRAME Or %WS_CAPTION Or %WS_SYSMENU Or %DS_CENTER To hDlg Control Add Label, hDlg, -1, "A PB/DLL 6.0 DDT example" & $CRLF & $CRLF & "by PowerBASIC Inc., 1999", _ 10, 10, 130, 34, %SS_CENTER Control Add Button, hDlg, 1, "&Ok", 55, 41, 40, 14 Call OkCallBack Beep Dialog Show Modal hDlg End Select End Select End Function CallBack Function CondDialogCallback Select Case CbMsg Case %WM_COMMAND If CbCtlMsg = %BN_CLICKED Then Dialog End CbHndl, 0 If CbCtl = %IDOK Then MsgBox "Yes" If CbCtl = %IDCANCEL Then MsgBox "No" End If End Select End Function CallBack Function CondCallBack Static hDlg As Long Local x As Long Control Set Focus hDlg, %IDOK Dialog New ghDlg, "Conditions", 0, 0, 150, 50, %DS_MODALFRAME Or %WS_CAPTION Or _ %DS_CENTER, %WS_EX_TOPMOST Or %WS_EX_TOOLWINDOW To hDlg If hDlg = 0 Then Exit Function ' Error occurred Control Add TextBox, hDlg, 1001, "La-La", 10, 7, 130, 14 Control Add Button, hDlg, %IDOK, "&Yes", 30, 30, 40, 14, %BS_DEFAULT Control Add Button, hDlg, %IDCANCEL, "&No", 80, 30, 40, 14 Control Set Focus hDlg, 1001 Dialog Show Modeless hDlg, Call CondDialogCallBack Do Dialog DoEvents Dialog Get Size hDlg To x, x Loop While x Dialog Show State ghDlg, %SW_SHOWNORMAL End Function CallBack Function DeleteCallBack Local hDlg As Long Local Result As Long ' Create the delete confirmation dialog Dialog New ghDlg, $AppTitle, 0, 0, 150, 50, %DS_MODALFRAME Or %WS_CAPTION Or _ %WS_SYSMENU Or %DS_CENTER To hDlg Control Add Label, hDlg, -1, "Are you sure you wish to" & $CRLF & _ "delete this record?", 10, 7, 130, 28, %SS_CENTER Control Add Button, hDlg, %IDOK, "&Ok", 30, 30, 40, 14 Call OkCallBack Control Add Button, hDlg, %IDCANCEL, "&Cancel", 80, 30, 40, 14 Call CancelCallBack Beep Dialog Show Modal hDlg To Result End Function Function PbMain Local Result As Long Local hPopup1 As Long Local hPopup2 As Long Local hPopup3 As Long Local hDlg As Long Local hMenu As Long Dialog New 0, $AppTitle, 77, 22, 400, 267, _ %DS_CENTER Or %WS_CAPTION Or %WS_SYSMENU, 0 To hDlg ghDlg = hDlg Control Add Label, hDlg, -1, "C&omments", 5, 160, 60, 8, %SS_RIGHT Control Add TextBox, hDlg, %id_Comments, "115", 68, 158, 323, 65, %ES_AUTOHSCROLL Or %ES_AUTOVSCROLL Or %ES_MULTILINE Or %ES_WANTRETURN Or %WS_TABSTOP Or %WS_VSCROLL, %WS_EX_CLIENTEDGE Control Add Button, hDlg, %id_COND, "&Conditions", 210, 233, 40, 14 Call CondCallBack Control Add Button, hDlg, %id_Delete, "&Delete", 260, 233, 40, 14 Call DeleteCallBack Menu New Bar To hMenu Menu New Popup To hPopup1 Menu Add String, hPopup1, "&Close", %IDCANCEL, %MF_ENABLED, Call CancelCallBack Menu Add Popup, hMenu, "&Task", hPopup1, %MF_ENABLED Menu New Popup To hPopup3 Menu Add String, hPopup3, "&Help", %id_Menu_Help, %MF_ENABLED Menu Add String, hPopup3, "-", 0, 0 Menu Add String, hPopup3, "&About", %id_Menu_About, %MF_ENABLED Menu Add Popup, hMenu, "&Help", hPopup3, %MF_ENABLED Menu Attach hMenu, hDlg Dialog Show Modal hDlg, Call AddressCallBack To Result End Function
[This message has been edited by Semen Matusovski (edited February 27, 2000).]
Leave a comment:
-
Guest repliedSemen
Did you have anything particular in mind ?. The source code is not mine to release. I can however put together code fragments as soon as I learn how to import text to this reply function.
The complete source code runs to over 1700 lines. I have also checked out the references you mentioned.
regards....
------------------
Leave a comment:
-
Barney --
Can you post "clean" fragment ?
------------------
Leave a comment:
-
Guest repliedSemen
Thanks for the response. The problem is not so much as how to trap the ALT+letter response, but as to why ALT+C , ALT+x work for the Main Dialog, ALT+C works fine for the Error and Licence Dialog's but ALT+Y and ALT+N dont work for the Conditions Dialog.
With the exception of ALT+x for the main Dialog, all the other buttons are required to END their respective dialogs and return to the main Callback thread so that another Dialog (if required) can be invoked).
the common callback for each ALT+letter is one that just has
DIALOG END CBHNDL, 0.
The callback for the ALT+Y and ALT+N sets a variable depending upon which button is pressed and executes the same DIALOG END CBHNDL, 0 so I can proceed with my main callback processing.
The debugging shows that the ALT+Y/ALT+N callback code is entered, the variable is set but the DIALOG END CBHNDL, 0 statement just doesnt fire unless the callback is entered as a result of a mouse click.
------------------
Leave a comment:
-
barney --
if you want to use menu, look http://www.powerbasic.com/support/pb...ead.php?t=1842
like i understand situation:
1) you can use "native" api
2) or - if you are brave - to use mixed technology, not officially recognized by pb (see my sample with resource file on first page)
if you want to organize simple "hot"-keys, look http://www.powerbasic.com/support/pb...ad.php?t=12662
(not recognized, but also there are no negative comments)
------------------
[this message has been edited by semen matusovski (edited february 26, 2000).]
Leave a comment:
-
DDT and the Keyboard accelerators
I have an App that uses 4 Dialog Boxes and PBMAIN.
- Main Dialog with buttons for "&Clear" and "E&xit"
- Error Dialog with a single button "&Continue"
- Conditions Dialog with buttons for "&Yes" and "&No"
- Licence Dialog with a single button "&Continue"
All dialog's except the Conditions dialog respond as expected to their respective keyboard accellerators.
Like the TAB, ENTER and ESC keys are ALT_Y and ALT_N reserved keyboard responses ?. I have tried using the same Callback routine but the Conditions Dialog will only work when clicked by the Mouse.
Unfortunately the people using this App are sight impaired and cannot use the Mouse.
All buttons are created using the same (except for the caption) style parameters.
Has any one any suggestions as why I have this behaviour and therefore a solution ?.Tags: None
Leave a comment: