Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > New Scripting Engine (GS2)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-26-2008, 02:30 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
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.
Reply With Quote
  #2  
Old 05-26-2008, 02:43 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
What do you mean? Don't add a new one each time!
__________________
Reply With Quote
  #3  
Old 05-26-2008, 02:50 AM
Programmer Programmer is offline
Coder
Programmer's Avatar
Join Date: Jan 2008
Location: -78.464422, 106.837328
Posts: 449
Programmer has a spectacular aura aboutProgrammer has a spectacular aura about
Send a message via AIM to Programmer Send a message via MSN to Programmer Send a message via Yahoo to Programmer
Quote:
Originally Posted by Stryke View Post
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..";
__________________
- Iᴀɴ Zɪᴍᴍᴇʀᴍᴀɴ
Reply With Quote
  #4  
Old 05-26-2008, 03:05 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
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*.
Reply With Quote
  #5  
Old 05-26-2008, 03:26 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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.
__________________
Reply With Quote
  #6  
Old 05-26-2008, 03:47 AM
Stryke Stryke is offline
Scripter
Join Date: Apr 2008
Posts: 157
Stryke is an unknown quantity at this point
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().
Reply With Quote
  #7  
Old 05-26-2008, 03:50 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Why the sleep?
Reply With Quote
  #8  
Old 05-26-2008, 04:05 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
I think to show it is going up ...
__________________
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 04:08 PM.


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