wxMenu bug?

In Unix (Solaris), when calling wxMenu.Append or wxMenu.Insert with a label that contains a '/' (i.e. /home/gsuberri/python), wxMenu.GetLabel(id) returns a string with the slashes reversed (i.e. \home\gsuberri\python). Any idea why?

Gilad

Gilad Suberri wrote:

In Unix (Solaris), when calling wxMenu.Append or wxMenu.Insert with a
label that contains a '/' (i.e. /home/gsuberri/python),
wxMenu.GetLabel(id) returns a string with the slashes reversed (i.e.
\home\gsuberri\python). Any idea why?

Because GTK uses the slashes to denote submenus, so wx is changing the '/' text to '\'. I don't know if there is a way around it or not...

···

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

FYI,

There is some difference with the gtk2 build of wxWindows/
wxPython2.4.1.2. For example, this menu item

   menu = wx.Menu()
   menu.Append(id, '/one/two/three', ...)

does show up as "/one/two/tree' in the menu, i.e. with just
forward slashes. But the result returned by

   menu.GetLabel(id)

is "\/one\/two\/three" after printing it to stdout. It may
even be "\\/one\\/two\\/three"?

/Jean Brouwers
  ProphICy Semiconductor

Robin Dunn wrote:

···

Gilad Suberri wrote:

In Unix (Solaris), when calling wxMenu.Append or wxMenu.Insert with a
label that contains a '/' (i.e. /home/gsuberri/python),
wxMenu.GetLabel(id) returns a string with the slashes reversed (i.e.
\home\gsuberri\python). Any idea why?

Because GTK uses the slashes to denote submenus, so wx is changing the '/' text to '\'. I don't know if there is a way around it or not...

How can I tell if I am on a system that will do that?

Gilad

···

----- Original Message -----
From: "Robin Dunn" <robin@alldunn.com>
To: <wxPython-users@lists.wxwindows.org>
Sent: Wednesday, October 29, 2003 4:23 PM
Subject: Re: [wxPython-users] wxMenu bug?

Gilad Suberri wrote:
> In Unix (Solaris), when calling wxMenu.Append or wxMenu.Insert with a
> label that contains a '/' (i.e. /home/gsuberri/python),
> wxMenu.GetLabel(id) returns a string with the slashes reversed (i.e.
> \home\gsuberri\python). Any idea why?

Because GTK uses the slashes to denote submenus, so wx is changing the
'/' text to '\'. I don't know if there is a way around it or not...

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

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org

Jean Brouwers wrote:

FYI,

There is some difference with the gtk2 build of wxWindows/
wxPython2.4.1.2. For example, this menu item

  menu = wx.Menu()
  menu.Append(id, '/one/two/three', ...)

does show up as "/one/two/tree' in the menu, i.e. with just
forward slashes. But the result returned by

  menu.GetLabel(id)

is "\/one\/two\/three" after printing it to stdout. It may
even be "\\/one\\/two\\/three"?

It's "escaping" the forward slashes so they can still be ued as forward slashes and not interpreted as submenus. I would have expected that to be done with the gtk1 version too, and it may still be able to be. Please enter a bug report about it.

···

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

Gilad Suberri wrote:

How can I tell if I am on a system that will do that?

Look at wxPlatform.

···

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

Done, it is bug #833371.

/Jean

Robin Dunn wrote:

···

Jean Brouwers wrote:

FYI,

There is some difference with the gtk2 build of wxWindows/
wxPython2.4.1.2. For example, this menu item

  menu = wx.Menu()
  menu.Append(id, '/one/two/three', ...)

does show up as "/one/two/tree' in the menu, i.e. with just
forward slashes. But the result returned by

  menu.GetLabel(id)

is "\/one\/two\/three" after printing it to stdout. It may
even be "\\/one\\/two\\/three"?

It's "escaping" the forward slashes so they can still be ued as forward slashes and not interpreted as submenus. I would have expected that to be done with the gtk1 version too, and it may still be able to be. Please enter a bug report about it.