Help!! Where are the mouseEvents?
BlitzMax Forums/BlitzMax Beginners Area/Help!! Where are the mouseEvents?
| ||
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? |
| ||
|
| ||
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]. |
| ||
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 |
| ||
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! |
| ||
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. |
| ||
EnabledPolledInput()...hmmm That does the trick! Don't you think I can safely use it? After all, it is the easiest solution. |
| ||
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. |
| ||
Klept02: many thanks! Based on your example, I wrote a mouseType to save the status of the mouse. |