Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   News-Window (https://forums.graalonline.com/forums/showthread.php?t=84684)

Schetti 03-14-2009 05:56 PM

News-Window
 
I hope you like this news window.
You can list News/Updates, Hiring infos and currently staffs.
Thats my first post, so dont bee too hard.

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
ExampleWindow = new GuiWindowCtrl("ExampleWindow");
  
  
with (ExampleWindow)
  {
    
profile     "GuiBlueWindowProfile";
    
position    "562 225";
    
extent      "545 555";
    
canMove     true;
    
canResize   false;
    
canMaximize false;
    
canClose    true;
    
tile        true;
    
text        "News";
    
    new 
GuiControl(NewsTab)
    {
      
visible    false;
      
profile    "GuiBlueControlProfile";
      
position   "7.5 52";
      
extent     "531 495";
      
    new 
GuiScrollCtrl("MyGUI_MultiLine1_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 800;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 800;
      
1;

      new 
GuiMLTextCtrl("MyGUI_MultiLine1") {
        
profile GuiBlueMLTextProfile;
        
height 16;
        
horizsizing "width";
        
text " News here";                                        

        
width 518;
       }
      };
    };
    
    new 
GuiControl(HiringsTab)
    {
      
visible    false;
      
profile    "GuiBlueControlProfile";
      
position   "7.5 52";
      
extent     "531 495";
      
    new 
GuiScrollCtrl("MyGUI_MultiLine2_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 800;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 800;
      
1;

      new 
GuiMLTextCtrl("MyGUI_MultiLine2") {
        
profile GuiBlueMLTextProfile;
        
height 16;
        
horizsizing "width";
        
text "Hiring datas here";                                        

        
width 518;
      }
    };
   };
    
    new 
GuiControl(StaffsTab)
    {
      
visible    false;
      
profile    "GuiBlueControlProfile";
      
position   "7.5 52";
      
extent     "531 495";
      
    new 
GuiScrollCtrl("MyGUI_MultiLine3_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 800;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 800;
      
1;

      new 
GuiMLTextCtrl("MyGUI_MultiLine3") {
        
profile GuiBlueMLTextProfile;
        
height 16;
        
horizsizing "width";
        
text "Staff list here";                                        

        
width 518;
       }
      };
    };
    
    new 
GuiTabCtrl(ExampleTabs)
    {
      
profile   "GuiBlueTabProfile";
      
position  "10 28";
      
extent    "300 24";
      
      
clearRows();
      
with (addRow(0"News"))
      {
        
this.pane NewsTab;
      }
      
with (addRow(1"Hirings"))
      {
        
this.pane HiringsTab;
      }
      
with (addRow(2"Staffs"))
      {
        
this.pane StaffsTab;
      }
      
      
thiso.catchevent(name"onSelect""onTabSelect");
    };
  };
  
ExampleTabs.setSelectedById(0);
  
GraalControl.addControl(ExampleWindow);
}

function 
onTabSelect(tabs)
{
  for (
temp.tabtemp.tabs.rows)
  {
    if (
temp.tab.pane == null)
    {
      continue;
    }
    
    if (
temp.tab == temp.tabs.selected)
    {
      
temp.tab.pane.show();
    }
    else
    {
      
temp.tab.pane.hide();
    }
  }



Angel_Light 03-14-2009 06:34 PM

Good Job, looks quite professional. =]

styling tip : With multiple vars that are being set to the same thing you can just use '='
ie
PHP Code:

....  
  
tile     
  
canMove  =
  
canClose true;

  
canResize   =
  
canMaximize false;
.... 

also, you can save lines by using

position = { x, y};
extent = { width, height};

in this format you can do operations which you can't do in the "x y" format.

cbk1994 03-14-2009 08:16 PM

Looks good. Can you post a screenshot? I made something similar here.

Schetti 03-14-2009 08:32 PM

1 Attachment(s)
>_<

if I see that one mines bad.
:cry:

cyan3 03-14-2009 08:52 PM

Nice work, it looks great ^^

cbk1994 03-14-2009 09:49 PM

I like yours. Only thing is it might be a bit too large.

Schetti 03-14-2009 10:00 PM

Well
I have to learn how to use scrolls,
so I made it big eneugh for begin.

xXziroXx 03-14-2009 11:15 PM

Quote:

Originally Posted by Angel_Light (Post 1474443)
styling tip : With multiple vars that are being set to the same thing you can just use '='

That's the worst suggestion I've seen posted in a long time. For one, it would require you to edit the "max length" of all the variable as soon as you add a new variable that has a longer name then the previously longest one.

MiniOne 03-14-2009 11:41 PM

I think stefan stole your idea xD

LoneAngelIbesu 03-15-2009 01:23 AM

I would suggest a GUI that can post the news to a file, and then load the text from that file in to the various tabbed panes.

I find that sticking to a single project and making it perfect is the best way to learn how to script.

Codein 03-15-2009 01:46 AM

Quote:

Originally Posted by xXziroXx (Post 1474562)
That's the worst suggestion I've seen posted in a long time. For one, it would require you to edit the "max length" of all the variable as soon as you add a new variable that has a longer name then the previously longest one.

I think he was refering to doing something like this:
temp.foo = temp.bar = 2;
However, I do agree with you.

cyan3 03-15-2009 02:29 AM

Quote:

Originally Posted by Schetti (Post 1474530)
Well
I have to learn how to use scrolls,
so I made it big eneugh for begin.

Correct me if I'm wrong but won't this make the gui scroll?

PHP Code:

new GuiScrollCtrl("MyGUI_MultiLine1_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 800;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 800;
      
1;

      new 
GuiMLTextCtrl("MyGUI_MultiLine1") {
        
profile GuiBlueMLTextProfile;
        
height 16;
        
horizsizing "width";
        
text " News here";                                        

        
width 518;
       }
      }; 


Angel_Light 03-15-2009 03:19 AM

Quote:

Originally Posted by xXziroXx (Post 1474562)
That's the worst suggestion I've seen posted in a long time. For one, it would require you to edit the "max length" of all the variable as soon as you add a new variable that has a longer name then the previously longest one.

I don't get the problem, it works great for me and I have never had a problem with it.... x_x

Schetti 03-15-2009 07:20 AM

Quote:

Originally Posted by cyan3 (Post 1474627)
Correct me if I'm wrong but won't this make the gui scroll?

PHP Code:

new GuiScrollCtrl("MyGUI_MultiLine1_Scroll") {
      
profile GuiBlueScrollProfile;
      
height 800;
      
hscrollbar "dynamic";
      
vscrollbar "dynamic";
      
width 800;
      
1;

      new 
GuiMLTextCtrl("MyGUI_MultiLine1") {
        
profile GuiBlueMLTextProfile;
        
height 16;
        
horizsizing "width";
        
text " News here";                                        

        
width 518;
       }
      }; 


umm...
I dont think so.
I made a LOOOOONG text, and it just didnt show up anymore.

how to say ...

the text goes out of the news window and wont be showen.

Mark Sir Link 03-15-2009 07:31 AM

it'd be a good idea to name the GUI objects something useful rather than "ExampleWindow" and MyGUI_ScrollLine2 etc


All times are GMT +2. The time now is 07:57 AM.

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