GUI: Left Click & Right Click on a image ?
GUI: Left Click & Right Click on a image ?
I want to get right click and left click on a GUI Image... In order to create custum GUI windows.
Right click: Close
Left click : Move
someone can help me? thanks !!
Hello,
I don't have any code for this, but some ideas.
I see that every IGUIElement in C++ implementation is IEventReceiver,
which means all elements should have overridable OnEvent(), where
you could check if user clikced withing area of the control.
But unfortunately .NET implementation is poor and lacks this.
Another option would be to GetElementFromPoint on the root element,
something like:
But you have to check if that element is visible or not covered by another
child element.
I don't have any code for this, but some ideas.
I see that every IGUIElement in C++ implementation is IEventReceiver,
which means all elements should have overridable OnEvent(), where
you could check if user clikced withing area of the control.
But unfortunately .NET implementation is poor and lacks this.
Another option would be to GetElementFromPoint on the root element,
something like:
Code: Select all
Position2D pos = new Position2D(x,y);
device.GUIEnvironment.RootGUIElement.GetElementFromPoint(pos);
child element.
-
- Posts: 279
- Joined: Fri Dec 24, 2004 6:37 pm
Use the onkey event to get the clicks. Then check if cursor.x and cursor.y is in the area of the image. Then if you want to move, get the difference between the positionx of the image and the current cursorx and the positiony of the image and the current cursory. Then check for left-click up event. At that point take the cursor x and cursor y and deduce the previous distance calculated previously. The distance stuff is done so that the image movement is like windows drag command.
Just the theory make the code yourself.
Just the theory make the code yourself.