Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   GuiTextCtrl inside of GuiTextListEntry? (https://forums.graalonline.com/forums/showthread.php?t=80751)

LoneAngelIbesu 07-23-2008 06:43 AM

GuiTextCtrl inside of GuiTextListEntry?
 
While creating (or at least trying to >_<) the trading system for Valikorlia, I realized that I wasn't accounting for duplicate items. So, I had the idea of having a text control at the bottom right-hand corner of the item's icon. However, I haven't had much luck.

I've tried creating a GuiTextCtrl inside the GuiTextListEntry, but it doesn't work. I've also tried creating it outside of the GuiTextListEntry, and it still doesn't work. Each time I try to create a GuiTextCtrl inside of this particular loop, it breaks and no rows are added at all.

Below is the chunk of code I'm dealing with. Note that temp.i is declared at the start of the function.
PHP Code:

    new GuiScrollCtrl("Trade_Inventory_Scroll") {
      
profile GuiScrollProfile;
      
height 225;
      
hscrollbar "alwaysOff";
      
vscrollbar "dynamic";
      
width 165;

      new 
GuiTextListCtrl("Trade_Inventory") {
        
profile GuiTextListProfile;
        
height 32;
        
horizsizing "width";
        
seticonsize(32,32);
        for(
0thiso.archlist.size(); i++) {
          if(
thiso.archlist[i][0] == "gold") {
            continue;
          }
          
with(addrow(ithiso.archlist[i][3])) {
            
this.archname thiso.archlist[i][0];
            
this.iconimg thiso.archlist[i][1];
            
this.value thiso.archlist[i][2];
            
this.name_sl thiso.archlist[i][3];
            
this.name_pl thiso.archlist[i][4];
            
this.count thiso.archlist[i][5];
            
this.icon.drawimage(00this.iconimg);
            
this.hint "Value: " this.value;
          }
          
/*
            -- Trying to add it outside of the addrow()
               does not work. Neither does adding it
               inside of the addrow().
               
          new GuiTextCtrl("Trade_" @ thiso.archlist[i][0]  @ "_Count") {
            profile = GuiInventoryItemTextProfile;
            x = Trade_Inventory.rows[i].x + 15;
            y = Trade_Inventory.rows[i].y + 15;
            text = "x" @ thiso.archlist[i][5];
          }*/
        
}
      }
    } 


zokemon 07-24-2008 10:37 AM

GuiTextListEntry's aren't actual real GUI objects but are just standard objects the contain information for another GUI object (in this case, a GuiTextListCtrl).

My suggestion:

Create a second GuiTextListCtrl on top of your first one with the same x,y,w,h and with active set to false (0). You may need to edit the profile of that text list ctrl to edit font sizes and such but you should eventually be able to display what you want and since active is false, the gui is treated as if it isn't there when you click.

Inverness 07-24-2008 11:13 AM

I thought I told you to create the GuiTextCtrl objects inside the GuiTextListCtrl then find where to draw the text from the entries. If you can't create those inside the GuiTextListCtrl then the obvious thing to do is just create them after it.

Don't listen to Zero :p

zokemon 07-24-2008 06:28 PM

Quote:

Originally Posted by Inverness (Post 1407684)
I thought I told you to create the GuiTextCtrl objects inside the GuiTextListCtrl then find where to draw the text from the entries. If you can't create those inside the GuiTextListCtrl then the obvious thing to do is just create them after it.

Don't listen to Zero :p

You have to create more objects that way though!

My way is way cooler :)

LoneAngelIbesu 07-24-2008 08:10 PM

Quote:

Originally Posted by Inverness (Post 1407684)
I thought I told you to create the GuiTextCtrl objects inside the GuiTextListCtrl then find where to draw the text from the entries. If you can't create those inside the GuiTextListCtrl then the obvious thing to do is just create them after it.

Don't listen to Zero :p

I tried, and it didn't work. :rolleyes: I even tried an entirely new loop. I can't create the controls outside of the GuiTextListCtrl, because I cannot access each separate row's x and y coordinate (Trade_Inventory.rows[i].x/y returns 0). If what you suggested did work, I wouldn't have asked the forums. I'll try and see if Zero's idea works.

Inverness 07-24-2008 08:11 PM

Zeros Way: GuiTextListCtrl + # of GuiTextListEntry
My Way: # of GuiTextCtrl

Though I expect the GuiTextCtrl to take more total memory, the computer can handle it.

And I'm Dylan's boss anyways.

Edit: Dear Idiot, don't create it inside the GuiTextListCtrl, create them after the control so it draws over it.

LoneAngelIbesu 07-24-2008 08:16 PM

I tried. Zero's idea is better, in my opinion. Besides, it's easier to deal with rows. If I did what you suggested, I'd have to remove the text control once the user chooses the item (thus, moving the item's row to another text-list control), then move all other text controls' y values; in order to move the y values, I'd have to figure out which text controls are below the selected item's row. Using another text-list control seems much simpler.

Inverness 07-24-2008 09:23 PM

Making things look nice isn't always easy. Don't be lazy.

LoneAngelIbesu 07-24-2008 09:51 PM

The two ideas have the same result. One's easier. I'm choosing that one. :) Unless you have some idea that's easier.


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

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