Page 1 of 1

Posted: Thu Nov 21, 2002 12:48 pm
by BackupUser
Restored from previous forum. Originally posted by Kale.

Is it possible to add visual shortcuts in menus? like this piece of python code:

Code: Select all

self.fileMenu.add_command(label="New", accelerator="Ctrl+N", command=self.newFile)
is there a way to display the "Ctrl+N" next to the title "New"? i have been using this:

Code: Select all

MenuItem( #MENU_ITEM_SAVE, "New...    Ctrl+N")
but sometimes you get the spacing wrong using spaces in the title string.

--Kale

New to PureBasic and falling in Love! :)

Posted: Thu Nov 21, 2002 4:27 pm
by BackupUser
Restored from previous forum. Originally posted by Froggerprogger.


MenuItem(1, "New" + Chr(9) + "Crtl+N")
MenuItem(2, "Save File as... " + Chr(9) + "Shift+S")

Chr(9) is the ASCII-code of tabulator.
And the 1st Tabstop in the Menu is behind the longest itemtext before the tab in the current Menu.

Here's some code:

Code: Select all

OpenWindow(1,0,0,600,200,#PB_Window_Systemmenu, "erituh")

CreateMenu(1, WindowID())
  MenuTitle("File")
  MenuItem(1,"New"+Chr(9)+"Ctrl+N")
  MenuItem(2,"Save File..."+Chr(9)+"Ctrl+S")
  MenuItem(3,"Save this file as a new one to..."+Chr(9)+"Ctrl+S")
  MenuItem(3,"But"+Chr(9)+"just"+Chr(9)+"OneTab")

Resume=1
While Resume

Select WaitWindowEvent()
  Case #PB_EventCloseWindow
    Resume=0
EndSelect

Wend


Purebasic - what a nice name for a girl-friend

Posted: Thu Nov 21, 2002 6:22 pm
by BackupUser
Restored from previous forum. Originally posted by Kale.

great! thanks Frogger :)

--Kale

New to PureBasic and falling in Love! :)