I never used this stuff in PB yet.
Only VB of course.
I only used &Caption so far..
Maybe you are speaking of the fact that i just hooked the control and used WM_KEY... and GetKeyState() to dist. VK_CONTROL.
(There was only 1 control in this case)
?
------------------
[email protected]
Announcement
Collapse
No announcement yet.
DDT, accelerators, modal to modeless
Collapse
X
-
Aisin --
I have no idea, why you received an error. Probably, a line is too long, and forum software added something.
Ok, here is longer variant (rc compiles it fine on my PC).
Code:Menu1 Menu {Popup "&File" {MENUITEM "&New\tCtrl+N", 10 MENUITEM "&Open...\tCtrl+O", 11 MENUITEM "&Save\tCtrl+S", 12 } } Menu1 ACCELERATORS {"^N", 10 "^O", 11 "^S", 12}
Can you give a sample in SDK-style, where menu works w/o accelerators and w/o direct processing keyboard events ?
------------------
E-MAIL: [email protected]
Leave a comment:
-
Guest repliedHi,
I can't make the PBR file when I compile t.rc file I
get the error2104, undefine keyword menuitem.
Am I missing something?
Please help.
------------------
Leave a comment:
-
Yes, this is what i was afraid of, extra stuff to make it work unf.
Thanks for the example anyway!
------------------
[email protected]
Leave a comment:
-
Edwin --
Test this.
rc.file (t.rc)
Code:Menu1 Menu {Popup "&File" {MENUITEM "&New\tCtrl+N", 10 MENUITEM "&Open...\tCtrl+O", 11 MENUITEM "&Save\tCtrl+S", 12}} Menu1 ACCELERATORS {"^N", 10 "^O", 11 "^S", 12}
Code:#Compile Exe #Register None #Dim All #Include "WIN32API.INC" #Resource "t.PBR" CallBack Function DlgProc() Select Case CbMsg Case %WM_COMMAND Select Case CbCtl Case 10 : MsgBox "New" Case 11 : MsgBox "Open" Case 12 : MsgBox "Save" End Select Case %WM_DESTROY PostQuitMessage 0 End Select End Function Function PbMain Local hDlg As Long Dialog New 0, "Test Ctrl-O -N -S", ,, 160, 60, %WS_SYSMENU Or %WS_CAPTION To hDlg Control Add TextBox, hDlg, 101, "", 10, 10, 140, 12, 0 Control Add Button, hDlg, %IDOK, "OK", 60, 30, 40, 14, %BS_DEFAULT Dim hAccel As Long, msg As tagMsg, hMenu As Long hMenu = LoadMenu (GetModuleHandle(ByVal 0&), "Menu1") Menu Attach hMenu, hDlg hAccel = LoadAccelerators(GetModuleHandle(ByVal 0&), "Menu1") Dialog Show Modeless hDlg, Call DlgProc While GetMessage(Msg, %NULL, 0, 0) If TranslateAccelerator(hDlg, hAccel, Msg) Then ElseIf IsDialogMessage (hDlg, Msg) Then Else TranslateMessage Msg DispatchMessage Msg End If Wend DeleteObject hAccel: DeleteObject hMenu End Function
E-MAIL: [email protected]
Leave a comment:
-
2) I would like (as you said) to get a notification via WM_COMMAND if i simply set the ctrl-key combination.
For this matter i'm not sure if i need an additional accelerator table to do this.
Suppose we have a 'Copy CTRL-C' menu item.
Can DDT recognize the CTRL-c combination autom. instead of using additional code?
Never used a menu with this so far.
3) If menus having to many items, Windows will 'wrap' the menus so that they will fit on the screen.
Somehow the DDT menu i created in the WM_INITDIALOG, does not wrap it's contents.
Several items are simply below the lowest screen coordinate. (below taskbar)
I tried the MENUBREAK and MENUBARBREAK but that didn't help.
Thanks,
------------------
[email protected]
Leave a comment:
-
1. If the dialog is modal, then you cannot change this part way through... if you really need a modeless, then create a modeless dialog to begin with.
2. CTRL+<key> is a "private" accelerator - if you use an accelerator table, a given keycombination will generate the appropriate %WM_COMMAND notification for the accelerator. What exactly do you want to achieve, Edwin?
3. Can you give us a demo/example of your menu problem?
Thanks!
------------------
Lance
PowerBASIC Support
mailto:[email protected][email protected]</A>
Leave a comment:
-
DDT, accelerators, modal to modeless
Hello,
1) MSDN states that a modal dialog needs to be destroyed to leave the message pump.
Is this so or is there an alternative to get a modal to modeless dialog?
2) I use a ddt dialog with a menu, the help does not say anything about the CTRL+key part.
I fixed that part.
The dialog does not react on the CTRL+.. keys.
Is it necessary to use additional code or resources? (Accelerators)
I solved it by trapping the WM_KEYUP etc...
It's not the way to do that.
3) MSDN says that menus are aut. breaked when to much items to show.
In my DDT dialog all the menus go out of sight.
How come?
???
------------------
[email protected]Tags: None
Leave a comment: