SOLVED: The mouse cursor change to the hand icon when over any GUI button..

Started by barefoot, Sat 19/03/2011 04:56:45

Previous topic - Next topic

barefoot

Hi

I'm wondering. mainly because I would like to do this, is it possible to have the mouse cursor change to the hand icon when over any GUI button?

cheers

barefoot



I May Not Be Perfect but I Have A Big Heart ..

monkey0506

Yes, yes it is possible:

Code: ags
// GlobalScript.asc

function repeatedly_execute_always()
{
  GUIControl *gcat = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
  if ((gcat == null) || (gcat.AsButton == null)) mouse.UseDefaultGraphic();
  else mouse.UseModeGraphic(eModeHand);
}


That's a bit a bit selfish as it doesn't directly interoperate nicely with other scripts, but it fits the task at hand, and with a bit of tweaking could be made to work with other scripts where you may be using the UseModeGraphic function.

barefoot

Thanks very much Monkey.. I'll give it a go..

cheers  :=

barefoot
I May Not Be Perfect but I Have A Big Heart ..

barefoot

Yep.. this works for me  :=

Code: ags

function repeatedly_execute_always()
{
  GUIControl *gcat = GUIControl.GetAtScreenXY(mouse.x, mouse.y);
  if ((gcat == null) || (gcat.AsButton == null)) mouse.UseDefaultGraphic();
  else mouse.UseModeGraphic(2);
}


cheers Monkey.. Thanks a million...

barefoot

I May Not Be Perfect but I Have A Big Heart ..

monkey0506

Can I ask why you would want to use an arbitrary number in place of the cursor's name (by way of the eMode enumerated value)? From a technical standpoint the two are completely equatable within AGS, but I don't understand why that would be preferable to you (as a human..you are human, right? :o)

barefoot

Hi Monkey

the reason is because an error comes up when i use (eModeHand); for some reason...

Iv'e since discovered that using (eModeInteract); actually works the same as the number you so rightly pointed out to me..  :=

And yes, I am human.. I think  (but not too hard)  ;D  

barefoot
I May Not Be Perfect but I Have A Big Heart ..

SMF spam blocked by CleanTalk