Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   gui object questions (https://forums.graalonline.com/forums/showthread.php?t=64122)

Prozac 02-15-2006 03:33 AM

gui object questions
 
1 Attachment(s)
The gui information is great on the wiki .net and .us sites, but beyond names like window button and text box, I get a little lost without pictures to tell me what's what.

Based on this example of the Rudora help system, can someone please tell me what Gui(fillintheblank)Ctrl names are for these items, and then I can look up how to use them with the refrence tools on my own.

1 - tab menus
2 - the image
3 - the banner area
4 - the option list, and is that an image next to each item, or a default arrow?
5 - the scrollbar attached to what appears to be a textbox. and can you attach a scrollbar to an option list?

thanks in adance for the help

Rick 02-15-2006 05:23 AM

1. GuiTabCtrl - I've written a tutorial on how to use those (at least the way I do).
2. GuiBitmapCtrl.
3. There is nothing there?
4. GuiTreeViewCtrl.
5. GuiMLTextCtrl contained within a GuiScrollCtrl.

Now, I'm not the coder of that script so I could be wrong on a couple things, but that is what it looks like to me.

Prozac 02-15-2006 07:23 AM

thanks, I have made good progress, but on the Tree controll, when I click on a node, I want it to change the text in a scrolling text box. select() appears to be the only likely command to detect if a node in the tree is clicked, there is really not enough information on the Tree control to tell me what i need to know to make it work.

Within the window:
PHP Code:


// the option list
  
new GuiScrollCtrl("item_scroll")
    {
    
width=150;
    
height=300;

   new 
GuiTreeViewCtrl("item_list")
     {
      
width=150;
      
height=400;
      
columns="0 16";
      
visible=true;  
      
addnode("test1");   
      
addnode("test2");   
      
addnode("test3");   
     }
  }

// scrolling text window
  
new GuiScrollCtrl("item_desc_scroll")
    {
    
width=150;
    
height=150;
    
    new 
GuiMLTextCtrl("item_desc_text")
      {
        
wordwrap=true;
        
text="hi there i am some text";
      }
    }

/* so this is what i tried to detect the action of the node being clicked with the mouse to change the text box to something else. But it dosent work. What is the propper detection for that action?*/

function onitem_list.select()
{
  
item_desc_text.text="you clicked a node";


thanks again for the support

Rick 02-15-2006 08:10 AM

What's the problem? item_list.getselectednode() should return the selected node.

ApothiX 02-15-2006 02:52 PM

Quote:

Originally Posted by Rick
What's the problem? item_list.getselectednode() should return the selected node.

Can you add properties when you create the node? like:

temp.node = addnode("Test1");
temp.node.coolprop = "WeeEeeE";

then access the node.coolprop in .select() ?

Skyld 02-15-2006 07:31 PM

Ah, thank you Prozac. You pointed out an error in my News Browser.

Rick 02-15-2006 07:44 PM

Quote:

Originally Posted by ApothiX
Can you add properties when you create the node? like:

temp.node = addnode("Test1");
temp.node.coolprop = "WeeEeeE";

then access the node.coolprop in .select() ?

Yes. A node is GuiTreeViewNode.

Prozac 02-16-2006 01:23 AM

1 Attachment(s)
hm i dont think my follow up question on the nodes was clear.
asking with a picture helped before, so i will do it again:

and Skyld, what was wrong with your menu? i was not looking to correct anything in your gui.

so: how do i detect that a node has been clicked? what does the event block look like, that will have item_desc_text.text="new text"; inside it?
where in relation to the gui creation should the 'click on a node' event detection go?
does it need to be in a timeout loop?

Rick 02-16-2006 01:56 AM

onSelect should work fine?

Prozac 02-16-2006 02:18 AM

nope.

PHP Code:

// made the gui window and items as listed above

function onSelect()
{
  
player.chat=item_list.getselectednode();
  
item_desc_text.text="you clicked a node";


that is an event block, and the text does not change.

try again ... i am looking for the same event thats triggered on the F8 window when you click on a world, and it changes the text (and image)

Maniaman 02-16-2006 04:37 AM

You need to include the ctrl name in the onSelect() thing

NPC Code:

function ctrlname.onSelect() {
player.chat = "whoah";
}


Rick 02-16-2006 06:12 AM

Oh, oops. I hadn't noticed that, I figured he was doing a catchevent or something.


All times are GMT +2. The time now is 11:23 PM.

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