Page 1 of 1

wxMAC - moving frames by toolbar or statusbar

Posted: Wed May 13, 2009 6:45 am
by victor-ki
Hi guys,

It is possible to move frames (windows) by clicking / dragging the toolbar & statusbar (but not only frame titlebar). It is a default behavior on OS X.

Is any default way exits to do that in wxWidgets?

wxWidgets 2.8.9.2 / Mac OS X 10.5.6

Posted: Thu May 14, 2009 12:40 am
by Auria
I'm not sure I understand; I never moved a window by dragging the statusbar on mac. About StatusBar, just use wxToolBar (or whatever it's called) this will use a native toolbar that should behave the same as in every other app

Posted: Thu May 14, 2009 4:02 am
by protocol
I noticed the same issue. No, there is no "default" way to do it. From what I've noticed, you will have to roll your own mouse & drag events to get the native effect.

regards.

Managing mouse events

Posted: Fri May 15, 2009 7:33 am
by victor-ki
Thanks for the tip about mouse events. Today I tried to do that, but I don't receive any events once the toolbar is attached to a frame (wx.Frame.SetToolBar). So, I don't have any ideas how to catch them.

Forgot to say, I'm using wxPython 2.8.9.2.

Posted: Sat May 16, 2009 12:58 am
by Auria
Weird. Is it a native toolbar? My wxWidgets app used a native toolbar on OS X and can be dragged around like every other app

Re: Managing mouse events

Posted: Sat May 16, 2009 5:27 am
by protocol
victor-ki wrote:Thanks for the tip about mouse events. Today I tried to do that, but I don't receive any events once the toolbar is attached to a frame (wx.Frame.SetToolBar). So, I don't have any ideas how to catch them.

Forgot to say, I'm using wxPython 2.8.9.2.
I frequently use wxPython 2.x

Post your current code for the event bind logic, I may still be able to help.

Posted: Sun May 17, 2009 6:03 pm
by victor-ki
This is a small script which I created to play with a toolbar.

Code: Select all

import wx

class MainToolBar(wx.ToolBar):
    def __init__(self, Parent):
        wx.ToolBar.__init__(self, Parent)
        self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse)
        self.AddSeparator()
        self.Realize()
        
    def OnMouse(self, Event):
        print "event"
        Event.Skip()

class MainFrame(wx.Frame):
    def __init__(self, Parent):
        wx.Frame.__init__(self, Parent)
        ToolBar = MainToolBar(self)
        self.SetToolBar(ToolBar)

app = wx.App(redirect=False)
frame = MainFrame(None)
frame.Show()
app.MainLoop() 

Posted: Sun May 17, 2009 6:06 pm
by victor-ki
Auria wrote:Weird. Is it a native toolbar? My wxWidgets app used a native toolbar on OS X and can be dragged around like every other app
Yes, it looks like a native toolbar.

Posted: Thu May 21, 2009 5:01 am
by protocol
The wxToolbar works as expected for the C++ build, but it does not work for the wxPython build. You may want to report a bug to the wxPython project.

Posted: Thu May 21, 2009 12:39 pm
by victor-ki
Thanks for the research!