![]() |
Global mouse checks
I've encountered this problem multiple times while working with GUI's in Graal. There is no 'universal' check for mouseclicks. onMouseUp, for example, only fires when the mouse is released inside GraalControl. The main problem arises when dealing with the drag function for GUI's. Ideally, if you start a drag inside a GUI, you don't want the functionality of it to stop working just because you leave the GUI... it makes it tedious to work. If I start dragging my mouse and leave the GUI, it messes the script up, and I've yet to find a way to work around this.
Either way, functions like onMouseUp and onMouseDown should be relevant to the GUIContainer, not GraalControl. |
There are different ways to detect that.
1. Use the built-in dragndrop system: MyControl.canmove = true; MyControl.clipmove = false, and then write code into "function MyControl.StopDrag" 2. When you start clicking in a control and then move the mouse outside then normally the previous control is getting the onMouseUp 3. Force that the GraalControl has the focus with GraalControl.makefirstresponder(true) and then just update the position of your dragndrop control to match the mouse position until the mouse has been released. It is easy to detect if the mouse is still down while the graalcontrol has the focus (variable mousebuttons). 4. Write a function onFirstResponderChanges(obj) to keep track of the currently selected GUI control. 5. Use mousebuttonsglobal |
A simple drag'n'drop script:
PHP Code:
|
All times are GMT +2. The time now is 05:28 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.