Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   GuiMLTextCtrl and GuiScrollCtrl (https://forums.graalonline.com/forums/showthread.php?t=79829)

Stryke 05-26-2008 02:30 AM

GuiMLTextCtrl and GuiScrollCtrl
 
Everytime I add a new GuiMLTextCtrl inside the GuiScrollCtrl, it scrolls all the way up, so I fix this by using scrolltoBottom(). However it's annoying because it looks like the scroll bar is glitched. Is there a way to keep that scroll bar down?

BTW, this is for chatting.

cbk1994 05-26-2008 02:43 AM

What do you mean? Don't add a new one each time!

Programmer 05-26-2008 02:50 AM

Quote:

Originally Posted by Stryke (Post 1392379)
Everytime I add a new GuiMLTextCtrl inside the GuiScrollCtrl, it scrolls all the way up, so I fix this by using scrolltoBottom(). However it's annoying because it looks like the scroll bar is glitched. Is there a way to keep that scroll bar down?

BTW, this is for chatting.

You don't need to re-add it every time you update the text ...

GuiMLTextCtrl.text @= "Whatever..";

Stryke 05-26-2008 03:05 AM

What I mean is, this is a chatting system inside a trading system.
Everytime onPlayerChats is called, it creates a new GuiMLTextCtrl inside
a GuiScrollCtrl. But, the scrollbar goes all the way up, which prevents the
players from seeing the most recent chat message without scrolling down
themselves.

Even when you don't add a new one each time it'll still do that since
the text variable is being edited. *Tried it*.

cbk1994 05-26-2008 03:26 AM

It doesn't go up to the top, it stays where it is if you add something to the text variable.

Just use scrolltobottom() when you add something.

Stryke 05-26-2008 03:47 AM

PHP Code:

//#CLIENTSIDE 
function onPlayerChats() 

  
temp.fontSize TradeChatList.profile.fontsize
  
temp.fontType TradeChatList.profile.fonttype
  
temp.fontWidth getTextWidth(temp.fontSizetemp.fontTypeNULLplayer.chat); 
  if(
temp.fontWidth>5850
  { 
    
TradeChatListText.text @= "<br>Your chat message is too long, please make it shorter."
    
player.chat ""
  } else { 
    
TradeChatListText.text @= "<br>" player.account ": " player.chat
    
player.chat ""
  } 
  
sleep(0.01); 
  
TradeChatList.scrolltoBottom(); 


function 
onCreated() 

  new 
GuiScrollCtrl("TradeChatList"
  { 
    
profile GuiBlueScrollProfile
    
profile.border 4
    
position = { 233 }; 
    
width 330
    
height 60
    
hScrollBar "dynamic"
    
vScrollBar "alwaysOn"
    new 
GuiMLTextCtrl("TradeChatListText"
    { 
      
profile GuiBlueMLTextProfile
      
position = { }; 
      
width 300
      
height 10
      
text "Trade Initialized with players: " player.account " and " client.TradePlayer "."
    } 
  } 


It will go up.. then in 0.01 seconds, go down because of scrolltoBottom().

DustyPorViva 05-26-2008 03:50 AM

Why the sleep?

cbk1994 05-26-2008 04:05 AM

I think to show it is going up ...


All times are GMT +2. The time now is 04:08 PM.

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