Help!! Where are the mouseEvents?

BlitzMax Forums/BlitzMax Beginners Area/Help!! Where are the mouseEvents?

Kistjes(Posted 2007) [#1]
If you take the createCanvas.bmx example and you add a line to show the mouseX() and mouseY() the mouseposition remains 0,0!!!!

Check this:

How can I check the mouse location in a graphics canvas?


klepto2(Posted 2007) [#2]



degac(Posted 2007) [#3]
I dont' remember, but MouseX() MouseY() work with Graphics enabled, to retrieve info about the pointer under MaxGUI you need to check EventX(), EventY() [I'm at work at the moment...so I can't check].


Brucey(Posted 2007) [#4]
MouseX/Y are Graphics mode functions

EventX() and EventY() are the ones you want... but they'll only be available from you EVENT_MOUSEMOVE event, not EVENT_GADGETPAINT.

:-)

Edit : or klepto can rewrite it for you :-p


Kistjes(Posted 2007) [#5]
Ok. I found the answer myself. I checked the event objects reference.

I was trying to make a nice combination of a graphical interface and TGadgets but that seems hard to realize.

Perhaps anyone of you can give me some advice.
I'm making a prototype of a not-windows-like user interface: interactive graphic objects, a user can manipulate with the mouse (like click and drag). Some objects have a popup menu (also not windows like). But in this popup a user can select a numeric value and changes that. For this value I was planned to use a TextField gadget with a Slider gadget (the stepper version). Everything works fine so far until I discovered that mouseEvents in a CanvasGraphics area are handled differently.

I see two approaches:
1. create my own "textfield-with-stepper"-gadget object or
2. create a new mouseEvent controller using EventID()

I have no idea what to choose. Any help is very much appreciated!


klepto2(Posted 2007) [#6]
Here is a second Version using MouseEvents on the one hand and
the traditional MouseX() etc commands. To get the normal Key and Mouse commands to work within a Canvas you have to enable the 'polled Input'. This is done by using the undocumented command 'EnablePolleDInput()'. But keep in mind that when using this you don't get the whole CPU Advantage a only eventdriven app does have.




Kistjes(Posted 2007) [#7]
EnabledPolledInput()...hmmm
That does the trick!
Don't you think I can safely use it? After all, it is the easiest solution.


klepto2(Posted 2007) [#8]
I have used it many times without any problems. If you want to use it, use it. Some people will say it is not save but for me everything was fine using this. So keep using this.


Kistjes(Posted 2007) [#9]
Klept02: many thanks!
Based on your example, I wrote a mouseType to save the status of the mouse.