Paul McNett wrote:
Robin Dunn writes:
wxNotebook.SetPageText(pageIndex,"H&ello")
doesn't have the expected result. I wanted the "e" to be
underlined and an automatic accelerator for Alt+E, similar
to other controls such as menu items
This is how I fake it:
1) Create menu items with method for each tab
menu = wxMenu() menu.Append(self.ID_SELECT_1ST_PAGE, "1st page\tCTRL-A")
menu.Append(self.ID_SELECT_2ND_PAGE, "2nd page\tCTRL-B")
EVT_MENU(self, self.ID_SELECT_1ST_PAGE, self.OnSelect1stPage)
EVT_MENU(self, self.ID_SELECT_2ND_PAGE, self.OnSelect2ndPage)
2) Create bitmap images for each notebook tab's text with the underline character to indicate the accelerator key and assign it to wxImageList:
self.notebook_imagelist = wxImageList(136, 17)
self.notebook_imagelist.Add(images.getadd_app_selectBitmap())
self.notebook_imagelist.Add(images.getedit_app_selectBitmap())
self.notebook.AssignImageList(self.notebook_imagelist)
2) Set each notebook page to use the correct image:
self.notebook.SetPageImage(0, 0) ##set image for 1st notebook page
self.notebook.SetPageImage(1, 1) ## set image for 2nd notebook page
4) Set each method to cals the correct tab:
def OnSelect1stPage(self, event)
self.notebook.SetSelection(0) def OnSelect2ndPage(self, event):
self.notebook.SetSelection(1)
With the appropriate acclerator key (Ctrl + a), the user will trigger the menu's event for the appropriate method to set the page.
I don't think this is supported.
It doesn't appear to be, which is a shame. Anyone have any ideas on how to at least "fake it"? I'm converting my app framework from Visual FoxPro to wxPython and one thing my clients are used to is navigating the pages in my frames using the alt-keys instead of having to reach for the mouse. Each frame has between 3-n pages:
Page 1: Select: user can manipulate the where clause of the select statement
Page 2: Browse: user can incrementally browse the result set in a grid.
Page 3: Edit: user can edit the fields in the record that they selected on page 2.
Additional pages for child tables, etc.
Is there at least a way to provide for the user tabbing to the page tabs so they can use the arrow keys to select a page?
I set the style for all windows to use wxWANTS_CHARS and send all key event to the parent's window. So now I can define whatever key event in the parent's windows to trigger the correct respond. It is really really ugly but it works.
Hope this help.
Derrick Lim
···
Thanks!