Page 1 of 1

Posted: Tue Feb 25, 2003 2:00 pm
by BackupUser
Restored from previous forum. Originally posted by Naitfreak.

How do I create shortcuts for my menus? I mean like "Ctrl+N". I tried AddKeyboardShortcut() but it didn't work.

Posted: Tue Feb 25, 2003 2:48 pm
by BackupUser
Restored from previous forum. Originally posted by El_Choni.

AddKeyboardShortcut() works for me. Can you post an example?

El_Choni

Posted: Tue Feb 25, 2003 2:59 pm
by BackupUser
Restored from previous forum. Originally posted by Naitfreak.

Well, not really. All I can say is that when I insert this line "AddKeyboardShortcut(MainWin,#PB_Shortcut_C | #PB_Shortcut_Control,1)" PB completely crashes.

Posted: Tue Feb 25, 2003 4:16 pm
by BackupUser
Restored from previous forum. Originally posted by freak.

What are you taking as MainWin ?

Is it the Value you get with WindowID(), or the one you use with OpenWindow like OpwnWindow(MainWin, ...

It has to be the one from Openwindow, the PureBasic Window Number, not the ID (or handle) it gets from Windows.

Maybe this causes the crash.

Timo

Posted: Tue Feb 25, 2003 7:06 pm
by BackupUser
Restored from previous forum. Originally posted by Naitfreak.

Yup! That caused the crash! I used the wrong value for the '#window' variable. It works now.

But how can I integrate the visual shortcut like "Crtl+N" into the actual graphical representaion of the menu? I mean it's not done by simply but this next to the name of the specific menu item when you create it. It will look pretty disordered and will remain on wrong places when the width of the menu changes. Like when you have recent file list in your menu.

Is that possible at all?

Posted: Tue Feb 25, 2003 7:38 pm
by BackupUser
Restored from previous forum. Originally posted by Berikco.

use something like this

"New"+Chr(9)+"Ctrl+N"

Regards,

Berikco

http://www.benny.zeb.be/purebasic.htm

Posted: Tue Feb 25, 2003 7:41 pm
by BackupUser
Restored from previous forum. Originally posted by Hi-Toro.

Use Chr (9) [tab] to separate the 'Ctrl X' strings, like this:

Code: Select all

OpenWindow (0, 320, 200, 320, 200, #PB_Window_SystemMenu, "Test")

CreateMenu (0, WindowID ())
MenuTitle ("&File")
MenuItem (1, "Open file..." + Chr (9) + "Ctrl O")
MenuItem (2, "Save file..." + Chr (9) + "Ctrl S")
MenuItem (3, "Read a really good book before going to bed..." + Chr (9) + "Ctrl R")
MenuItem (4, "Exit..." + Chr (9) + "Ctrl E")

Repeat

Until WaitWindowEvent () = #PB_Event_CloseWindow
End

--
See ya,
James L Boyd.
http://www.hi-toro.com/
--

Posted: Wed Feb 26, 2003 2:16 am
by BackupUser
Restored from previous forum. Originally posted by TheBeck.

I think this kind of stuff should be in the manual. I spent several hours trying to solve this very problem recently. I only figured it out by examining the PureBasic editor source code.

Posted: Wed Feb 26, 2003 10:43 am
by BackupUser
Restored from previous forum. Originally posted by Kale.

The forum search gave me this, you should try the search function first, its very helpful :):
viewtopic.php?t=2571

--Kale

In love with PureBasic! :)

Posted: Wed Feb 26, 2003 5:54 pm
by BackupUser
Restored from previous forum. Originally posted by Naitfreak.

Adding 'Chr(9)' works wounders for me. Thank's a bunch but as TheBeck pointed out this should really be added/updated in PB manual.

Lata~