static text and combobox in the toolbar

190 views
Skip to first unread message

Philippe Ney

unread,
Apr 8, 2003, 5:24:03 AM4/8/03
to wxPython-users
Hi all,

In the application I'm developping, I put some buttons (tools) and a static
text and a combobox (controls) in the toolbar.

This perfectly work under linux but under windows, the static text and the
combobox are displayed at the same place at the beginning of the toolbar on
top of the buttons...

The placement of the tools and controls in the toolbar are done in a relative
way (not absolute).

Is there some known behavior under windows like :
* no control in toolbar
* tools and controls have to be defined in an absolute way

Or is this due to bugs in my code :) ?


Thanks for any tips,
-philippe


-------8<--------------------------------------
[...]
# A Toolbar
# using the CreatToolBar methode of the frame create a toolbar
# that is managed by the frame (wxFrame::CreateToolBar).
toolBar = self.CreateToolBar ()

# Populate the toolbar with useful tools and controls :)
# 1) a button for compose a new message (wxITEM_NORMAL)
toolBar.AddTool (ID_COMPOSE,
wxBitmap ("images/compose.png", wxBITMAP_TYPE_PNG),
longHelpString = "Compose a new message")
# 2) a button for reply to a message (wxITEM_NORMAL)
toolBar.AddTool (ID_REPLY,
wxBitmap ("images/reply.png", wxBITMAP_TYPE_PNG),
longHelpString = "Reply to this message")
# a separator
toolBar.AddSeparator ()
# 3) buttons to select next message and to delete selected message
toolBar.AddTool (ID_NEXT,
wxBitmap ("images/next.png", wxBITMAP_TYPE_PNG),
longHelpString = "select next message")
toolBar.AddTool (ID_DELETE,
wxBitmap ("images/delete.png", wxBITMAP_TYPE_PNG),
longHelpString = "Delete selected message")
toolBar.AddSeparator ()
# 4) a combobox for the name with a label
person_label = wxStaticText (toolBar, -1, "Selected :",
wxPoint (0, 0))
person_combo = wxComboBox (toolBar, ID_PERSON)
toolBar.AddControl (person_label)
toolBar.AddSeparator ()
toolBar.AddControl (person_combo)

# Adding the ToolBar to the Frame content.
self.SetToolBar (toolBar)
[...]
-------8<--------------------------------------

Robin Dunn

unread,
Apr 8, 2003, 10:35:58 PM4/8/03
to wxPytho...@lists.wxwindows.org
Philippe Ney wrote:
> Hi all,
>
> In the application I'm developping, I put some buttons (tools) and a static
> text and a combobox (controls) in the toolbar.
>
> This perfectly work under linux but under windows, the static text and the
> combobox are displayed at the same place at the beginning of the toolbar on
> top of the buttons...
>
> The placement of the tools and controls in the toolbar are done in a relative
> way (not absolute).
>
> Is there some known behavior under windows like :
> * no control in toolbar
> * tools and controls have to be defined in an absolute way
>
> Or is this due to bugs in my code :) ?
>

You don't call toolBar.Realize()


--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Philippe Ney

unread,
Apr 9, 2003, 6:32:07 AM4/9/03
to wxPytho...@lists.wxwindows.org
> > Hi all,
> >
> > In the application I'm developping, I put some buttons (tools) and a

[...]

> > * tools and controls have to be defined in an absolute way
> >
> > Or is this due to bugs in my code :) ?
> >
>
> You don't call toolBar.Realize()

Yessss! It works now.

Thanks a lot,
-philippe

Reply all
Reply to author
Forward
0 new messages