Author Topic: GUI Scroll Problem [RESOLVED]  (Read 9964 times)

Okay, so, I'm making a cheesy little IRC thing, which is not serious and do NOT plan on releasing, as it is more of a test thing.
But, whenever I add text to the MultiLine Text control, the scroll control does not stay in the original place or move to the bottom. I have tried adding namehere.scrollToBottom(); to many things, but it always lands up at the very top. I am not sure what is causing this, and have tried looking at other things that use the scroll control as well, and could not come up with my own solution.
So, for everyone that is familiar with GUI's, I'm asking for your help.
« Last Edit: December 08, 2014, 05:58:57 PM by Frostwind »

Try this:

yourTextCtrl.reflowText();
yourScrollCtrl.scrollToBottom();

(and make sure that the text control is the only child of the scroll control.

Try this:

yourTextCtrl.reflowText();
yourScrollCtrl.scrollToBottom();

(and make sure that the text control is the only child of the scroll control.
Will try when I get home. Thanks!

Greek2me's solution did not work for me. Any other suggestions?

What are you using inside the scroll?


Hm, is there anything else?

Hm, is there anything else?
No, just that parented to the scroll.

Can you show the gui code?

Can you show the gui code?
cant right now, in school. But later I will.

Okay, here's the GUI code.

Code: [Select]
//--- OBJECT WRITE BEGIN ---
new GuiControl(NewGui) {
   profile = "GuiDefaultProfile";
   horizSizing = "right";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 2";
   enabled = "1";
   visible = "1";
   clipToParent = "1";

   new GuiWindowCtrl() {
      profile = "GuiWindowProfile";
      horizSizing = "right";
      vertSizing = "bottom";
      position = "128 109";
      extent = "368 200";
      minExtent = "8 2";
      enabled = "1";
      visible = "1";
      clipToParent = "1";
      maxLength = "255";
      resizeWidth = "1";
      resizeHeight = "1";
      canMove = "1";
      canClose = "1";
      canMinimize = "1";
      canMaximize = "1";
      minSize = "50 50";
      closeCommand = "canvas.popDialog(NewGui);";

      new GuiScrollCtrl(chatScroll) {
         profile = "GuiScrollProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "9 33";
         extent = "352 138";
         minExtent = "8 2";
         enabled = "1";
         visible = "1";
         clipToParent = "1";
         willFirstRespond = "0";
         hScrollBar = "dynamic";
         vScrollBar = "dynamic";
         constantThumbHeight = "0";
         childMargin = "0 0";
         rowHeight = "40";
         columnWidth = "30";

         new GuiMLTextCtrl(chatML) {
            profile = "GuiMLTextProfile";
            horizSizing = "right";
            vertSizing = "bottom";
            position = "1 1";
            extent = "329 14";
            minExtent = "8 2";
            enabled = "1";
            visible = "1";
            clipToParent = "1";
            lineSpacing = "2";
            allowColorChars = "1";
            maxChars = "-1";
            maxBitmapHeight = "-1";
            selectable = "1";
            autoResize = "1";
         };
      };
      new GuiTextEditCtrl(chatTextEdit) {
         profile = "GuiTextEditProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "9 175";
         extent = "303 18";
         minExtent = "8 2";
         enabled = "1";
         visible = "1";
         clipToParent = "1";
         maxLength = "255";
         historySize = "0";
         password = "0";
         tabComplete = "0";
         sinkAllKeyEvents = "0";
         altCommand = "chatSend();";
         accelerator = "enter";
      };
      new GuiButtonCtrl(chatButtonSend) {
         profile = "GuiButtonProfile";
         horizSizing = "right";
         vertSizing = "bottom";
         position = "314 174";
         extent = "48 21";
         minExtent = "8 2";
         enabled = "1";
         visible = "1";
         clipToParent = "1";
         command = "chatSend();";
         text = "Send";
         groupNum = "-1";
         buttonType = "PushButton";
      };
   };
};
//--- OBJECT WRITE END ---

I know I should have named it something else other than NewGui, but like I said, its original intent is for testing purposes.

Try using a GuiControl. It has always worked for me, same for a swatch control as well.

The issue was resolved. Here is the solution.

I replaced the guiMLTextCtrl with a guiMessageVectorCtrl, and entered the following before my client-side code.

Code: [Select]
function NewGui::onWake(%this)
{
    if(!isObject(TestVector))
        new MessageVector(TestVector);
        chatMV.attach(TestVector);
}

And to make the text appear on the MessageVector,
Code: [Select]
TestVector.pushBackLine("Message", false);

Solution was found by Pah1023, was discussed in steam chat.