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 07-23-2008, 06:43 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
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];
          }*/
        
}
      }
    } 
__________________
"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 07-24-2008, 10:37 AM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
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.
__________________
Do it with a DON!
Reply With Quote
  #3  
Old 07-24-2008, 11:13 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
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
__________________
Reply With Quote
  #4  
Old 07-24-2008, 06:28 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Inverness View Post
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
You have to create more objects that way though!

My way is way cooler
__________________
Do it with a DON!
Reply With Quote
  #5  
Old 07-24-2008, 08:10 PM
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
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
I tried, and it didn't work. 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.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #6  
Old 07-24-2008, 08:11 PM
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
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.
__________________
Reply With Quote
  #7  
Old 07-24-2008, 08:16 PM
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
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.
__________________
"We are all in the gutter, but some of us are looking at the stars."
— Oscar Wilde, Lady Windermere's Fan
Reply With Quote
  #8  
Old 07-24-2008, 09:23 PM
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
Making things look nice isn't always easy. Don't be lazy.
__________________
Reply With Quote
  #9  
Old 07-24-2008, 09:51 PM
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
The two ideas have the same result. One's easier. I'm choosing that one. Unless you have some idea that's easier.
__________________
"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 01:51 AM.


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