Are these all for menu items? Can they be used for buttons
interchangeably? Is ID_EDIT for a menu or menu item? What is ID_FILE3?
And is there some documentation page that I'm missing about this?
Those are Stock IDs. They should be used for menus and buttons for
common items that the represent so that wx can take care of some cross
platform differences for you automatically (especially for wxMac).
Using the stock id will allow for wx to automatically specify the
correct text (localized if available) for the item.
wx.Button(panel, wx.ID_COPY) # Note no need to specify the label
See the StockButtons example in the demo and the optimizing for mac
article in the wiki for some further info.
ID_FILE-ID_FILE9 are builtin ids for the when you use a wx.FileHistory menu.
Cody
···
On Mon, May 17, 2010 at 11:34 AM, cool-RR <ram.rachum@gmail.com> wrote:
Are these all for menu items? Can they be used for buttons
interchangeably?
The stock IDs can be used anywhere an ID is needed, and in some cases will trigger special or platform specific behavior. For example on wxGTK menu items or buttons with stock IDs will automatically be given an icon from the current theme (if the theme uses icons for menus and buttons) and on Mac menu items with the stock about, exit and preferences IDs will be moved to the application menu.
You can also do things like get stock labels from the stock IDs with wx.GetStockLabel, etc. Or you can let wx do it for you by creating the items with no label and just specify the stock ID.
Is ID_EDIT for a menu or menu item?
Menus don't use IDs, just menu items.
What is ID_FILE3?
wx.ID_FILE1..9 are used by the wx.FileHistory class and are used as the IDs for the menu items representing recently opened files.
And is there some documentation page that I'm missing about this?
Not all in one place, but they should be mentioned in the places where using stock IDs has meaning.
Are these all for menu items? Can they be used for buttons
interchangeably?
The stock IDs can be used anywhere an ID is needed, and in some cases will trigger special or platform specific behavior. For example on wxGTK menu items or buttons with stock IDs will automatically be given an icon from the current theme (if the theme uses icons for menus and buttons) and on Mac menu items with the stock about, exit and preferences IDs will be moved to the application menu.
You can also do things like get stock labels from the stock IDs with wx.GetStockLabel, etc. Or you can let wx do it for you by creating the items with no label and just specify the stock ID.
Is ID_EDIT for a menu or menu item?
Menus don’t use IDs, just menu items.
What is ID_FILE3?
wx.ID_FILE1…9 are used by the wx.FileHistory class and are used as the IDs for the menu items representing recently opened files.
And is there some documentation page that I’m missing about this?
Not all in one place, but they should be mentioned in the places where using stock IDs has meaning.
Are these all for menu items? Can they be used for buttons
interchangeably?
The stock IDs can be used anywhere an ID is needed, and in some cases will trigger special or platform specific behavior. For example on wxGTK menu items or buttons with stock IDs will automatically be given an icon from the current theme (if the theme uses icons for menus and buttons) and on Mac menu items with the stock about, exit and preferences IDs will be moved to the application menu.
You can also do things like get stock labels from the stock IDs with wx.GetStockLabel, etc. Or you can let wx do it for you by creating the items with no label and just specify the stock ID.
Is ID_EDIT for a menu or menu item?
Menus don’t use IDs, just menu items.
What is ID_FILE3?
wx.ID_FILE1…9 are used by the wx.FileHistory class and are used as the IDs for the menu items representing recently opened files.
And is there some documentation page that I’m missing about this?
Not all in one place, but they should be mentioned in the places where using stock IDs has meaning.
On 5/17/10 9:34 AM, cool-RR wrote:
Are these all for menu items? Can they be used for buttons
interchangeably?
The stock IDs can be used anywhere an ID is needed, and in some
cases will trigger special or platform specific behavior.
So let’s say I have a “cut” menu item and a “cut” toolbar button. Can I
give them both ID_CUT? Won’t that cause a problem?
No. EVT_MENU and EVT_TOOL are aliases for each other, so it is designed to allow the same ID to be used for both, and one Bind will take care of both. You only need to use different IDs (or let wx choose an ID by passing it -1) if you want the menu item and toolbar item to do different things.
No. EVT_MENU and EVT_TOOL are aliases for each other, so it is designed to allow the same ID to be used for both, and one Bind will take care of both. You only need to use different IDs (or let wx choose an ID by passing it -1) if you want the menu item and toolbar item to do different things.
···
On 5/17/10 11:38 AM, cool-RR wrote:
On Mon, May 17, 2010 at 7:26 PM, Robin Dunn <robin@alldunn.com > <mailto:robin@alldunn.com>> wrote:
On 5/17/10 9:34 AM, cool-RR wrote:
Are these all for menu items? Can they be used for buttons
interchangeably?
The stock IDs can be used anywhere an ID is needed, and in some
cases will trigger special or platform specific behavior.
So let's say I have a "cut" menu item and a "cut" toolbar button. Can I
give them both ID_CUT? Won't that cause a problem?