Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
[wxSmith] Two suggestions
(1/1)
Commodore64:
(If you want, I will open two feature requests at Berlios)
Currently, wxToolBar's are created using wxFrame::CreateToolBar.
I suggest to create toolbars using the constructor of wxToolBar, instead; and *optionally* add them to the wxFrame using wxFrame::SetToolBar.
This way, the user is free to use a toolbar created with wxSmith for other purposes. For example, to pass it to wxAUI.
Another suggestion: EVT_CLOSE is missing from wxFrame. May you add it?
Thank you :D
byo:
Hi, I've added EVT_CLOSE for wxDialog and wxFrame (comitted in rev. 3821), I've also switched to new wxToolBar instead of wxFrame::CreateToolBar.
I still have to think about the change to new wxToolBar because it introducess one shortcoming.
Wx docs for wxFrame::CreateToolBar() say:
--- Quote ---Under Pocket PC, you should always use this function for creating the toolbar to be managed by the frame, so that wxWidgets can use a combined menubar and toolbar. Where you manage your own toolbars, create a wxToolBar as usual.
--- End quote ---
So it may produce wxToolBar in some platform-specific manner, not always through creating wxToolBar. But I've looked into XRC source code and it creates toolbar using new, so probably this is the best solution for now.
But I still don't see how it could be used outside wxFrame (like in wxAUI). Curent implementation is limited to standard toolbars only and it creates toolbar just like it's done in CreateToolbar. I think that there may still be some problems when you want to use it exernally but I may be wrong :)
Regards
BYO
Commodore64:
Thank you byo: excellent support ;)
--- Quote from: byo on April 10, 2007, 12:40:50 am ---I still have to think about the change to new wxToolBar because it introducess one shortcoming.
Wx docs for wxFrame::CreateToolBar() say:
--- Quote ---Under Pocket PC, you should always use this function for creating the toolbar to be managed by the frame, so that wxWidgets can use a combined menubar and toolbar. Where you manage your own toolbars, create a wxToolBar as usual.
--- End quote ---
So it may produce wxToolBar in some platform-specific manner, not always through creating wxToolBar. But I've looked into XRC source code and it creates toolbar using new, so probably this is the best solution for now.
But I still don't see how it could be used outside wxFrame (like in wxAUI). Curent implementation is limited to standard toolbars only and it creates toolbar just like it's done in CreateToolbar. I think that there may still be some problems when you want to use it exernally but I may be wrong :)
--- End quote ---
From the wxAUI sample program:
--- Code: ---wxToolBar* tb1 = new wxToolBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxTB_FLAT | wxTB_NODIVIDER);
[...]
m_mgr.AddPane(tb1, wxAuiPaneInfo().
Name(wxT("tb1")).Caption(wxT("Big Toolbar")).
ToolbarPane().Top().
LeftDockable(false).RightDockable(false));
--- End code ---
Basically, it creates a wxToolBar using the constructor and it adds it to the wxAuiManager using the AddPane function, without adding the toolbar to the wxFrame directly.
You are right about the issue with Pocket PC. You may let the user choose among two possibilities: adding the toolbar "at the top or left of the frame", as the manual says (in this case wxFrame::CreateToolBar is used), or not (in this case the wxToolBar constructor is used, and it is the user's responsibility to do something useful with the created toolbar, like adding it to the frame using wxFrame::SetToolBar, or adding the toolbar to a wxAuiManager, or whatever).
byo:
--- Quote from: Commodore64 on April 10, 2007, 10:41:09 am ---Thank you byo: excellent support ;)
--- End quote ---
Nice to hear that :) Thanks
--- Quote ---Basically, it creates a wxToolBar using the constructor and it adds it to the wxAuiManager using the AddPane function, without adding the toolbar to the wxFrame directly.
You are right about the issue with Pocket PC. You may let the user choose among two possibilities: adding the toolbar "at the top or left of the frame", as the manual says (in this case wxFrame::CreateToolBar is used), or not (in this case the wxToolBar constructor is used, and it is the user's responsibility to do something useful with the created toolbar, like adding it to the frame using wxFrame::SetToolBar, or adding the toolbar to a wxAuiManager, or whatever).
--- End quote ---
Yup, allowing user to select the "mode" of toolbar creation sounds like the best solution (set to CreateToolbar by default but changable for more advanced users). I'll put this into my TODO list :)
Regards
BYO
Navigation
[0] Message Index
Go to full version