solved: SaveCursorUntilItLeaves problem

Started by Slasher, Tue 05/02/2013 09:07:18

Previous topic - Next topic

Slasher

Hi, niggling problem

The SaveCursorUntilItLeaves does not always release properly when it moves off gstatusline.gui after click a button on said gui.

Code: AGS
function repeatedly_execute_always() {
  
GUI *theGui = GUI.GetAtScreenXY(mouse.x, mouse.y);
 if (theGui == gStatusline) 
{
 mouse.SaveCursorUntilItLeaves();
 mouse.Mode = eModePointer;
 mouse.ChangeModeGraphic (eModePointer, 304); //304 being a custom pointer graphic
} 





Khris

#1
That's because mouse.SaveCursorUntilItLeaves() only works for Hotspots, Objects and Characters.

Code: ags
int old_mode;

function repeatedly_execute_always() {
  GUI* theGui = GUI.GetAtScreenXY(mouse.x, mouse.y);
  if (theGui == gStatusline && mouse.Mode != eModePointer) {
    old_mode = mouse.Mode;
    mouse.ChangeModeGraphic (eModePointer, 304);
    mouse.Mode = eModePointer;
  }
  if (theGui != gStatusline && mouse.Mode == eModePointer && mouse.GetModeGraphic(eModePointer) == 304) {
    mouse.mode = old_mode;
    // mouse.ChangeModeGraphic (eModePointer, ORIGINAL_POINTER_SLOT);
  }
}


Edit: corrected typo

Slasher

#2
Hi Khris,

thank you for that info.

unfortunately:

GlobalScript.asc(137): Error (line 137): undefined symbol 'theGUI'

This is line 137
Code: AGS
 if (theGUI != gStatusline && mouse.Mode == eModePointer && mouse.GetModeGraphic(eModePointer) == 304) {





Khris

Yeah, it's a typo, but really, try to fix this yourself. It's trivial.

Slasher

Cheer Khris

Got it all sorted now.

Thank you


SMF spam blocked by CleanTalk