Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 09-21-2008, 03:56 AM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
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");

__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #2  
Old 09-21-2008, 04:07 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
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
__________________
Reply With Quote
  #3  
Old 09-21-2008, 04:19 AM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by Chompy View Post
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.
Attached Thumbnails
Click image for larger version

Name:	Trade GUI.gif
Views:	139
Size:	126.2 KB
ID:	45954  
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #4  
Old 09-21-2008, 11:54 AM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Ah, ok
__________________
Reply With Quote
  #5  
Old 09-21-2008, 01:34 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
Let them ignore mouse events:
useownprofile = true;
profile.modal = false;
Reply With Quote
  #6  
Old 09-22-2008, 02:25 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Dylan, have items in GuiScrollCtrl perhaps?
__________________
Reply With Quote
  #7  
Old 09-23-2008, 01:16 AM
LoneAngelIbesu LoneAngelIbesu is offline
master of infinite loops
LoneAngelIbesu's Avatar
Join Date: May 2007
Location: Toldeo, Ohio
Posts: 1,049
LoneAngelIbesu has a spectacular aura aboutLoneAngelIbesu has a spectacular aura about
Send a message via AIM to LoneAngelIbesu
Quote:
Originally Posted by Inverness View Post
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.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 03:08 PM.


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