newbie question about wxwidget?

BlitzMax Forums/Brucey's Modules/newbie question about wxwidget?

DreamLoader(Posted 2009) [#1]
1.how to get the item under the mouse pointer in a treectrl/or in other gadgets? (eg. i want get the selecting item when i rightclick mouse in the treectrl)

2.how to use wxmouseevent properly? what kind of gadget can i
assign the event to ?(like i can use wxmousevent directly with wxGLcanvas,but i can't use it directly with treectrl?when connect mouse event with treectrl nothing happend!)

also there are two connect functions:connect/connect any,what's the difference?

sorry if the questions are "stupid",i am new to wxwidget,can't find more tutorial about wxEvent except brucy's!!


DavidDC(Posted 2009) [#2]
Untested but should be ok (he says hopefully!)

Method OnInit()
  Connect(GetId(),wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, _OnRightSelect)

Function _OnRightSelect(_event:wxEvent)
   TTreeView(_event.parent).OnRightSelect(wxCommandEvent(_event))

Method OnRightSelect(_event:wxCommandEvent)
  Local item:wxTreeItemId = GetSelection()



DreamLoader(Posted 2009) [#3]
thanks,
but i got an easy way, using wxtreeevent,with this i can easily
catch the selecting item,also the position point,

just use WxTreeEvent(event).getitem().


Brucey(Posted 2009) [#4]
also there are two connect functions:connect/connect any,what's the difference?

Connect() expects a window ID - this allows you to attach an event to a specific widget. You can define the ID for a widget when you create it.

ConnectAny() doesn't require a window ID. You usually use this if you are Connecting an event to the current widget, as opposed to a child widget.

ConnectRange() lets you catch a range of window IDs. Useful for menus or toolbars, where you are more likely to have sequences of IDs.