Is there a callback function to track the position of the mouse? If there was, clicking and dragging windows would be possible.
Mouse position
Posted by Darwin on Fri 08 Aug 2008 08:28 AM — 6 posts, 24,244 views.
No not at present. Dragging windows is more complex than knowing where the mouse is, otherwise I would have implemented that in the existing version.
It'll be useful when scripting miniwindows moving :> Just calculate mouse position difference between MouseDown and CancelMouseDown actions on hotspot, apply them, redraw window and done. Moving, resizing, even scrolling. Only this one thing is missing to make these things possible to code them clearly.
imo, it should be added. By the way I'm waiting only for this, to start code my own chatminiwindow plugin, then graphic scrollable/movable/clickable mapper. Summertime is ending, I wish it was added so far :\
PS: Nick, I know I'm grumbling all the time... I'd like you to know, that you make a really good stuff and I'm very impressed of your job. Big thanks and keep goin'! :)
imo, it should be added. By the way I'm waiting only for this, to start code my own chatminiwindow plugin, then graphic scrollable/movable/clickable mapper. Summertime is ending, I wish it was added so far :\
PS: Nick, I know I'm grumbling all the time... I'd like you to know, that you make a really good stuff and I'm very impressed of your job. Big thanks and keep goin'! :)
You will be pleased to hear that some sort of positive support for mouse dragging will be the next thing I will look at, now that version 4.36 is released.
I think it needs more than merely knowing the x,y position through GetInfo. A more useful thing would be an optional script that is called either during mouse movement, or upon mouse release.
For example, a scrollbar, which I am trying to do right now, really needs to know movement when it happens, whereas drag-and-drop is more interested in knowing where the drop occurs.
Just thinking aloud here a bit, but I think we probably need:
Let me know if you think I have omitted anything important.
Also I think an ability to have a pop-up menu at the mouse position, eg. if you click on an inventory item a menu might pop up "use/equip/drop/sell".
I think it needs more than merely knowing the x,y position through GetInfo. A more useful thing would be an optional script that is called either during mouse movement, or upon mouse release.
For example, a scrollbar, which I am trying to do right now, really needs to know movement when it happens, whereas drag-and-drop is more interested in knowing where the drop occurs.
Just thinking aloud here a bit, but I think we probably need:
- Script function to be called when the mouse moves (eg. to move a scrollbar thumb).
- Script function to be called when the mouse is released (eg. to reposition a window)
- Optional drag rectangle to be drawn during dragging (like when you drag windows around)
- Optional drag icon (eg. for dragging an item from inventory to equipment) which might show a sword being dragged
- Optional mouse pointer update during dragging (eg. to change between "OK to drop" and "don't drop here" icons)
- Optional designation of hotspots as drop targets - eg. if I can drag an inventory item to an equipped items window, the target window needs notification that the drop occurred.
Let me know if you think I have omitted anything important.
Also I think an ability to have a pop-up menu at the mouse position, eg. if you click on an inventory item a menu might pop up "use/equip/drop/sell".
The popup menu should be encodeable with miniwindows nicely, when mouse position will be added. But, if you're planning to make this stuff so good as written above, I think there're missing separate actions for rightclick/middleclick/middlescroll only (or separate var passed to called back functions).
One other suggestion I realised when writing last sentence: there should be an ability to send hotspot_id and some second optional var (eg. to pass which mouse button is pressed or other useful modificators) to callback function - to allow coders writing one function for multiple actions.
Anyway, if all above encoded - all these things with drops etc - it will be a first step to make mudlient looking best ever even dreamt. My God, game gui'ed almost as Tibia :D
One other suggestion I realised when writing last sentence: there should be an ability to send hotspot_id and some second optional var (eg. to pass which mouse button is pressed or other useful modificators) to callback function - to allow coders writing one function for multiple actions.
Anyway, if all above encoded - all these things with drops etc - it will be a first step to make mudlient looking best ever even dreamt. My God, game gui'ed almost as Tibia :D
Don't worry about the hotspot id, that would naturally be supplied to any callback functions, as well as provision for different mouse clicks.