Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   addControl(obj) (https://forums.graalonline.com/forums/showthread.php?t=71937)

Twizt3d 02-04-2007 07:34 AM

addControl(obj)
 
This command doesnt seem to be working... =\ heres an example that doesnt work for me. It's Briefed up a bit

PHP Code:

new GuiWindowCtrl("QMenu") {
    for (
temp.0temp.thiso.bags.size(); temp.i++){
      new 
GuiBitmapCtrl("Bag_"@thiso.bags[temp.i]){
        new 
GuiBitmapCtrl("BagIcon_"@thiso.bags[temp.i]) {
    
    
        }
      }
    }

    
    new 
GuiScrollCtrl("ItemsListScroll") {
    }
  }
  
GraalControl.addcontrol(QMenu);
}

//Seperate function
 
with (ItemsListScroll){
    for (
temp.0temp.makevar("thiso."@type).size(); temp.i++){
      new 
GuiBitmapCtrl("Q_Slot_"@temp.i) {
    
        new 
GuiShowImgCtrl("Q_Slot_Icon_"@temp.i) {
         
          
thiso.catchevent(name,"onMouseDown","onInvenDown")
            
          
        }
      }
    }
  }
}

//This is where the problem comes in:

function onInvenDown(obj){
   
GraalControl.addcontrol(obj);
}

//I have tried every different kind of combination. It still stays in the the parent it is in. I even tried: 
//with (QMenu) GraalControl.addControl(ItemsListScroll);
//It wont add it to GraalControl. It is like stuck in there =( 


zokemon 02-04-2007 09:25 AM

Uhh...your code is horribly styled and you seem to be missing something. If you are going to cut stuff out, at least leave the begining of functions and stuff so we know what is going on.

From what I see there, it looks like you are trying to do addcontrol for a GUI that is automatically added to GraalControl anyways?

Twizt3d 02-04-2007 10:20 AM

Well the styling is messed up because I took out a bunch of code. Also, I am trying to get one of the Q_Slot_Icon_ controls from its parent to GraalControl so I can move it around the entire screen rather then just inside its parent

Inverness 02-04-2007 11:04 AM

When you make a Gui Control using new GuiControlName() {} rather than varname = new GuiControlName(); then addcontrol() is automatically called.

If you want to move something around the screen then why not make it a separate image?

zokemon 02-04-2007 11:28 AM

Oh I see what you are doing...
First make sure the catchevent is actaully being caught with an echo or something else.
Second, I suggest you just make a "floater" icon that floats in the GraalControl and you just make it invisable until you start to "drag" the icon. Once you drag the icon, just transfer all the data to that floater :)

Twizt3d 02-04-2007 11:16 PM

I would just make a "floating" icon, but you can drag the entire windows so I would have to update all the icons. There are quite a few. The catchevent works. I know it does, I tested with echos like you said. The only thing I can think of is when u click on it, it creates a new ctrl in graalcontrol.

zokemon 02-05-2007 12:06 AM

Quote:

Originally Posted by Twizt3d (Post 1273368)
I would just make a "floating" icon, but you can drag the entire windows so I would have to update all the icons. There are quite a few. The catchevent works. I know it does, I tested with echos like you said. The only thing I can think of is when u click on it, it creates a new ctrl in graalcontrol.


No no no...
The icons stay in the window and never actaully move. When you go to "drag" them, the floating icon (which was invisiable) becomes visable and retains all the data from the icon you are dragging. The actaul icons stay in the window and don't move on their own o_o

Twizt3d 02-05-2007 02:00 AM

so just make one icon thats not visible in graalcontrol, lets say x = y = 0; then when u click on an icon the floater becomes visible and x = mousescreenx, blah blah, and all the data is set to it. hmm sounds like it will work. It would also make it easier to implement into my action bar. Thanks for Idea zero =)


All times are GMT +2. The time now is 01:12 PM.

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