|
From: John L. <jla...@gm...> - 2005-06-26 18:56:40
|
On 6/26/05, The Doctor <the...@bl...> wrote:
> I've tried to get notice of whether the event should propagate by default=
.
>=20
> event:ShouldPropagate()
> This returns an error, invalid method.
>=20
> It has the same structure as event:GetId() which works fine, so being a s=
imple thing I can't see what I could possibly get wrong. Does this mean tha=
t event:ShouldPropagate() doesn't exist in wxLua?
Yes, this is a new thing in 2.6 IIRC, we'll add it. I don't think
it'll solve this issue, but I haven't tried it myself.
=20
> And if control of propagation is missing, is there any way I can solve my=
mouse-click event problem?
You need to call the frame handler directly,=20
FRAME:GetEventHandler():ProcessEvent(event). This is the wxWidgets
design since you don't want parent of windows getting confused/baraded
by mouse/key events from the children. If you do this make sure that
you assign valid IDs to each window so you can distinguish them in you
event handler using event:GetId().
I hope this helps,
John Labenski
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
This seems to work as expected, you need to call FRAME:Close() not
FRAME:Destroy(). I added some other tests too.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
FRAME=3Dwx.wxFrame(wx.wxNull,-1,TITLE,wx.wxDefaultPosition,wx.wxSize(436,31=
4))
PANEL=3Dwx.wxPanel(FRAME,-1)
PAGES=3Dwx.wxNotebook(
PANEL,
-1,
wx.wxPoint(11,30),
wx.wxSize(405,230),
wx.wxNB_TOP
)
PAGE1 =3D wx.wxPanel(PAGES, -1)
SPIN1 =3D wx.wxSpinCtrl(PAGE1, -1)
BUTTON1 =3D wx.wxButton(PAGE1, -1, "Press Me", wx.wxPoint(0, 30))
PAGES:AddPage(PAGE1, "Hello")
function HandleEvent(event)
SPIN1:SetValue(SPIN1:GetValue()+1)
end
PANEL:ConnectEvent(-1, wx.wxEVT_LEFT_UP, HandleEvent)
BUTTON1:ConnectEvent(-1, wx.wxEVT_COMMAND_BUTTON_CLICKED, HandleEvent)
PANEL:ConnectEvent(-1, wx.wxEVT_RIGHT_UP,
function(event) FRAME:Close() end
)
FRAME:Centre()
FRAME:Show(wx.TRUE)
|