Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Problem with onMouseEnters and Gui Controls (https://forums.graalonline.com/forums/showthread.php?t=134260905)

Cubical 10-21-2010 08:15 PM

Problem with onMouseEnters and Gui Controls
 
I'm currently having a problem with Gui Controls not detecting the mouse for the full width and height of the control.

Here's a video, you can see at the bottom when I scroll over it only shows the display name for part of the control. Does anyone have any idea on what could be wrong?
http://www.youtube.com/watch?v=lMUzatAHrKw

Fulg0reSama 10-21-2010 08:22 PM

Well I'd guess showing the script that involves this would help as a start, and MAN THAT GUY CAN HIT FOR 10!

xXziroXx 10-21-2010 08:22 PM

You're positive that there's no control above it all?

Cubical 10-21-2010 08:23 PM

Quote:

Originally Posted by xXziroXx (Post 1607861)
You're positive that there's no control above it all?

positive, i even put a transparent guibitmapctrl on top of each one to test and it does the same thing.

Cubical 10-21-2010 08:29 PM

Here's the script
PHP Code:

public function updateInventory(){
  for (
temp.i = 0; temp.i < 42; temp.i++)
  {
    (@ 
"InventoryGuiBitmapCtrl_item_" @ temp.i).destroy();
  }
  
temp.itemlist = clientr.item.getdynamicvarnames();
  
temp.w = -1;
  for (
temp.i = 0; temp.i < temp.itemlist.size(); temp.i++)
  {
    if (
clientr.item.(@temp.itemlist[temp.i])[13] == this.selectedtab)
    {
      if (
temp.w > 4)
      {
        
temp.w = null;
        
temp.h++;
      }
      else
        
temp.w++;
      
with (InventoryGuiScrollCtrl_Contents){
        new 
GuiShowImgCtrl("InventoryGuiShowImgCtrl_item_" @ temp.i){
          
this.itemvars = {temp.itemlist[temp.i], clientr.item.(@temp.itemlist[temp.i])[9]};
          
x = (temp.w*33);
          
y = (temp.h*33);
          
image = clientr.item.(@temp.itemlist[temp.i])[12];
          
width = height = 32;
          
thiso.catchevent(name, "onMouseEnter", "onUpdateItemNameText");
          
thiso.catchevent(name, "onMouseLeave", "onClearItemNameText");
          
thiso.catchevent(name, "onMouseDown", "onTest");
          new 
GuiTextCtrl("InventoryGuiTextCtrl_item_" @ temp.i){
            
this.itemvars = {temp.itemlist[temp.i], clientr.item.(@temp.itemlist[temp.i])[9]};
            
x = 0;
            
y = 10;
            
width = height = 32;
            
useownprofile = true;
            
profile.align = "right";
            
profile.textshadow = true;
            
text = clientr.item.(@temp.itemlist[temp.i])[0];
            
thiso.catchevent(name, "onMouseEnter", "onUpdateItemNameText");
            
thiso.catchevent(name, "onMouseLeave", "onClearItemNameText");
            
thiso.catchevent(name, "onMouseDown", "onTest");
          }
        }
      }
    }
  }
  
GraalControl.makefirstresponder(true);
} 


xXziroXx 10-21-2010 08:30 PM

Quote:

Originally Posted by Cubical (Post 1607862)
positive, i even put a transparent guibitmapctrl on top of each one to test and it does the same thing.

Not sure then. Only times I've had issues like this is when some control was misplaced above the rest.

xXziroXx 10-21-2010 08:36 PM

First of all, you can replace

PHP Code:

  for (temp.i = 0; temp.i < 42; temp.i++)
  {
    (@ 
"InventoryGuiBitmapCtrl_item_" @ temp.i).destroy();
  } 

with

PHP Code:

InventoryGuiScrollCtrl_Contents.clearControls(); 

You also don't have to use temp.w and temp.h to determine the positions of the controls. Instead you could use this:

PHP Code:

x = 33*(temp.i%4);
y = 33*int(temp.y/4); 

I'm also fairly sure that your text controls is what messes it up. Try commenting them out. Why aren't you just setting text = clientr.item.(@temp.itemlist[temp.i])[0]; in the GuiShowImgCtrl though?

Cubical 10-21-2010 09:17 PM

Quote:

Originally Posted by xXziroXx (Post 1607865)
First of all, you can replace

PHP Code:

  for (temp.i = 0; temp.i < 42; temp.i++)
  {
    (@ 
"InventoryGuiBitmapCtrl_item_" @ temp.i).destroy();
  } 

with

PHP Code:

InventoryGuiScrollCtrl_Contents.clearControls(); 

You also don't have to use temp.w and temp.h to determine the positions of the controls. Instead you could use this:

PHP Code:

x = 33*(temp.i%4);
y = 33*int(temp.y/4); 

I'm also fairly sure that your text controls is what messes it up. Try commenting them out. Why aren't you just setting text = clientr.item.(@temp.itemlist[temp.i])[0]; in the GuiShowImgCtrl though?

I figured out what the problem was, I forgot I added a control in another WNPC. Anyways, thanks for the pointers especially the clearControls().

MrOmega 10-21-2010 10:23 PM

Just for future reference, you can do .bringToFront() so you know the control is on the top layer even if another GuiControl is covering it.

Cubical 10-22-2010 01:23 AM

Quote:

Originally Posted by MrOmega (Post 1607910)
Just for future reference, you can do .bringToFront() so you know the control is on the top layer even if another GuiControl is covering it.

yeah, I use that for a few gui controls on that wnpc


All times are GMT +2. The time now is 05:55 AM.

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