Martin Landa wrote:
Hi,
sorry for a newbie question, I have problem to place Save button in
StdDialogButtonSizer.# buttons
btnSave = wx.Button(self, wx.ID_SAVE)
btnApply = wx.Button(self, wx.ID_APPLY)
...# sizer
btnSizer = wx.StdDialogButtonSizer()
btnSizer.AddButton(btnCancel)
btnSizer.AddButton(btnSave)
btnSizer.AddButton(btnApply)
btnSizer.AddButton(btnOk)
btnSizer.Realize()result
http://josef.fsv.cvut.cz/~landa/wxpython/save_button.png
I tried to google it, maybe I am overlooking something. Or simply
wx.ID_SAVE is not supported by this class?
It is, but it is treated the same as the OK button, as is the wxID_YES button. They are all set to be the "affirmative" button in the AddButton method, and so when you add btnOk it will set that one to be the affirmative button and ignore btnSave. If you really need to have both buttons then you can probably add one of them to the sizer the normal way after you do the Realize.
void wxStdDialogButtonSizer::AddButton(wxButton *mybutton)
{
switch (mybutton->GetId())
{
case wxID_OK:
case wxID_YES:
case wxID_SAVE:
m_buttonAffirmative = mybutton;
break;
case wxID_APPLY:
m_buttonApply = mybutton;
break;
case wxID_NO:
m_buttonNegative = mybutton;
break;
case wxID_CANCEL:
m_buttonCancel = mybutton;
break;
case wxID_HELP:
case wxID_CONTEXT_HELP:
m_buttonHelp = mybutton;
break;
default:
break;
}
}
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!