wxMAC - moving frames by toolbar or statusbar Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
victor-ki
In need of some credit
In need of some credit
Posts: 9
Joined: Wed May 13, 2009 6:30 am

wxMAC - moving frames by toolbar or statusbar

Post 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
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post 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
"Keyboard not detected. Press F1 to continue"
-- Windows
protocol
Moderator
Moderator
Posts: 680
Joined: Wed Jan 18, 2006 6:13 pm
Location: Dallas, TX
Contact:

Post 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.
/* UIKit && wxWidgets 2.8 && Cocoa && .Net */
QuRegExmm
wxPCRE & ObjPCRE - Regex It!
victor-ki
In need of some credit
In need of some credit
Posts: 9
Joined: Wed May 13, 2009 6:30 am

Managing mouse events

Post 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.
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post 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
"Keyboard not detected. Press F1 to continue"
-- Windows
protocol
Moderator
Moderator
Posts: 680
Joined: Wed Jan 18, 2006 6:13 pm
Location: Dallas, TX
Contact:

Re: Managing mouse events

Post 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.
/* UIKit && wxWidgets 2.8 && Cocoa && .Net */
QuRegExmm
wxPCRE & ObjPCRE - Regex It!
victor-ki
In need of some credit
In need of some credit
Posts: 9
Joined: Wed May 13, 2009 6:30 am

Post 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() 
victor-ki
In need of some credit
In need of some credit
Posts: 9
Joined: Wed May 13, 2009 6:30 am

Post 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.
protocol
Moderator
Moderator
Posts: 680
Joined: Wed Jan 18, 2006 6:13 pm
Location: Dallas, TX
Contact:

Post 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.
/* UIKit && wxWidgets 2.8 && Cocoa && .Net */
QuRegExmm
wxPCRE & ObjPCRE - Regex It!
victor-ki
In need of some credit
In need of some credit
Posts: 9
Joined: Wed May 13, 2009 6:30 am

Post by victor-ki »

Thanks for the research!
Post Reply