Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   onMouseEnter/onMouseLeave (https://forums.graalonline.com/forums/showthread.php?t=81936)

LoneAngelIbesu 09-21-2008 03:56 AM

onMouseEnter/onMouseLeave
 
I'm trying to create a tooltip GUI. To do this, I'm using onMouseEnter/onMouseLeave. However, they aren't working the way I had hoped they would.

It seems that onMouseLeave is called when the mouse simply moves inside the GUI control, rather than actually leaving the control itself. My guess is that it's because the mouse is entering a child control. (See sample code attached.)

Is there a possibility of onMouseEnter/onMouseLeave to ignore child controls, if they are not used in the child control itself? I could use a timeout, but I'd really rather not.

Example code:
PHP Code:

function onCreated() {
   new 
GuiBitmapBorderCtrl("ItemBox1") {
     
this.profile GuiGrayBitmapBorderProfile;
     
this.canmove true;
     
this.canresize false;
     
this.100;
     
this.100;
     
this.width 64;
     
this.height 64;
     
this.archname "ironsword";
     
this.count 1;
     
this.fullname "Iron Sword";
     
thiso.catchevent(this.name"onMouseEnter""showtooltip");
     
thiso.catchevent(this.name"onMouseLeave""hidetooltip");
     new 
GuiShowImgCtrl("ItemBox1Img") {
       
this.15;
       
this.15;
       
this.width 32;
       
this.height 32;
       
this.image "mud_sword.png";
     }
   }
}
function 
showtooltip(control) {
  echo(
"show");
}
function 
hidetooltip() {
  echo(
"hide");



Chompy 09-21-2008 04:07 AM

Tried making the child controls inactive?


And,

PHP Code:

function onCreated() {
   new 
GuiBitmapBorderCtrl("ItemBox1") {
     
this.profile GuiGrayBitmapBorderProfile;
     
this.canmove true;
     
this.canresize false;
     
this.100;
     
this.100;
     
this.width 64;
     
this.height 64;
     
this.archname "ironsword";
     
this.count 1;
     
this.fullname "Iron Sword";
     new 
GuiShowImgCtrl("ItemBox1Img1") {
       
this.15;
       
this.15;
       
this.width 32;
       
this.height 32;
       
this.image "mud_sword.png";
       
thiso.catchevent(this.name"onMouseEnter""showtooltip");
       
thiso.catchevent(this.name"onMouseLeave""hidetooltip");
     }
     new 
GuiShowImgCtrl("ItemBox1Img2") {
       
this.46;
       
this.15;
       
this.width 32;
       
this.height 32;
       
this.image "mud_sword2.png";
       
thiso.catchevent(this.name"onMouseEnter""showtooltip");
       
thiso.catchevent(this.name"onMouseLeave""hidetooltip");
     }
   }
}
function 
showtooltip(control) {
  echo(
"show");
}
function 
hidetooltip() {
  echo(
"hide");


I don't see why you make the script catch the events when your mouse enter/leave the bitmapborder control, unless this is something you want.. if so, ignore this xD

LoneAngelIbesu 09-21-2008 04:19 AM

1 Attachment(s)
Quote:

Originally Posted by Chompy (Post 1425064)
Tried making the child controls inactive?

That worked, thanks. :P Why don't I ever think of these things. >_<
Quote:

I don't see why you make the script catch the events when your mouse enter/leave the bitmapborder control, unless this is something you want.. if so, ignore this xD
Each bitmap border control corresponds to 1 item in the user's inventory. See the attached image. ^^

Chompy 09-21-2008 11:54 AM

Ah, ok :p

Admins 09-21-2008 01:34 PM

Let them ignore mouse events:
useownprofile = true;
profile.modal = false;

Inverness 09-22-2008 02:25 AM

Dylan, have items in GuiScrollCtrl perhaps?

LoneAngelIbesu 09-23-2008 01:16 AM

Quote:

Originally Posted by Inverness (Post 1425402)
Dylan, have items in GuiScrollCtrl perhaps?

The item boxes are in a GuiScrollCtrl, now. Originally, I was going to dynamically change the size of the window, but then I remembered that not everybody is a minimalist like me, so most people have more than 16 items. >_<


All times are GMT +2. The time now is 07:32 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.