HOWTO: wxMouseEvent.Create(?)

BlitzMax Forums/Brucey's Modules/HOWTO: wxMouseEvent.Create(?)

MOBii(Posted 2014) [#1]
Import wx.wxMouseEvent

' I try to cheat without Create
Local event:wxSplitterEvent = (wxSplitterEvent)(_event)


MyMouseEvent:wxMouseEvent = New wxMouseEvent.Create(?) ' (wxEventPtr:Byte Ptr, EvtIntWrap:TEventHandler)

I want to feel the Button's But I don't understand the consept of wxMouseEvent/wxEvent

How can I Create a wxMouseEvent?


MOBii(Posted 2014) [#2]
Import wx.wxMouseEvent
...
Function OnPositionChanged(_event:wxEvent)
	Local mevent:wxMouseEvent = (wxMouseEvent)(_event)

	Print "---> " + mevent.Button(1)
End Function
All things get: EXCEPTION_ACCESS_VIOLATION with mevent


Derron(Posted 2014) [#3]
EAV means that you access something "Null"

I guess if you do a

if not mevent then print "mevent is null" right before your print "--->" you will get a nice second message printed to stdout.


bye
Ron


MOBii(Posted 2014) [#4]
Local event:wxSplitterEvent = wxSplitterEvent(_event)
Type wxSplitterEvent Extends wxNotifyEvent
Function Create:wxEvent(wxEventPtr:Byte Ptr, evt:TEventHandler)
I don't see how it get catched: wxSplitterEvent(_event)
wxSplitterEvent(_event) is Working!
So I use that to try understand how it works!


Local mevent:wxMouseEvent = ?
Type wxMouseEvent Extends wxEvent
Function _create:wxMouseEvent(wxEventPtr:Byte Ptr, userData:Object, parent:wxEvtHandler)



Derron(Posted 2014) [#5]
What does not work there?



Function _create:wxMouseEvent(wxEventPtr:Byte Ptr, userData:Object, parent:wxEvtHandler)

it expects a pointer of a wxEvent... so if you have eg. your "wxSplitterEvent", you could pass the pointer of that event:


new wxMouseEvent._create(theOverWxEvent.wxEventPtr, myUserDataObject, theOverWxEvent.parent)

the "parent" might be not available ... but I assume that something similar should work.


All above under the assumption that you want to do the following:
- there is something emitting an event (eg. wxSplitter)
- in that case you want to create a mouseEvent (simulate eg. a mousemovement, or click)




bye
Ron


MOBii(Posted 2014) [#6]
Sorry for being unclear again!

I want to see the State of the Mouse!
I don't see/understand how wxMouseEvent is working


Derron(Posted 2014) [#7]
a mouse event is created as soon as you click on a wxWidget or so ... so it cannot get used to receive a general "state" of the mouse.

WHEN do you want to get the mouse state? During another event (eg a "paint event") ?


Just state in some short phrases/headwords what you want to achieve in which situation.


bye
Ron


MOBii(Posted 2014) [#8]
connect(wxID_ANY, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED, OnPositionChanged)
connect(wxID_ANY, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, OnPositionChanging)
...
Function OnPositionChanged(_event:wxEvent)
	Local event:wxSplitterEvent = wxSplitterEvent(_event)
	...
	' Here I want to see If Left mouse is down: If Button(1) Then
	MFrame.CMDSplitter.SplitterPos = MFrame.CMDSplitter.GetSashPosition()
End Function
I have 2 SplitterWindows and I need something to separate them while sliding CMDSplitter


Derron(Posted 2014) [#9]
Whynot just check "MouseDown(1)" ?

I mean - you could use the BlitzMax-Mousefunction then.

Another thing: movement is only possible with the left mouse button ... so do you want to know if it is still down? If yes -- use MouseDown(1).



bye
Ron


MOBii(Posted 2014) [#10]
Thanks It's working but I still like to know how to setup wxMouseEvent

I found no example of this!


Derron(Posted 2014) [#11]
I think this is done in the depths of "c and h"-files.

Each window has its own mousemanager which generates the events for the associated widgets.

Dunno if it is exposed for us in BlitzMax (maybe like "bmx_wxmouseevent_buttondclick" in wxmouseevent.mod/common.bmx or glue.bmx



bye
Ron


MOBii(Posted 2014) [#12]
hmmm ^^/