Game Development Community

Problem with GuiScroll not scrolling

by Graham Evans · in Torque Game Engine · 12/16/2006 (3:13 pm) · 1 replies

Greetings all :)

Perhaps someone might be able to help me here 'cause I think I am being stupid again :)

In a GUI I have constructed, I have a GuiScrollCtrl as a container. Set up is like this :-

new GuiScrollCtrl(BuyWindow) {
         canSaveDynamicFields = "1";
         Profile = "GuiScrollProfile";
         HorizSizing = "right";
         VertSizing = "bottom";
         Position = "24 37";
         Extent = "245 200";
         MinExtent = "8 2";
         canSave = "1";
         Visible = "1";
         hovertime = "1000";
         willFirstRespond = "1";
         hScrollBar = "alwaysOff";
         vScrollBar = "alwaysOn";
         constantThumbHeight = "0";
         childMargin = "0 0";
      };

Into this container, I recursively add all items in an inventory by calling the server for an inventory listing and then item by item calling the client to add each new item into the window, one below another and showing them in a control called GuiBuyView which is a copy of the GuiObjectView control and a narrative in a text control by the side of the buyview control:-

function ClientCmdBuyGuiAddItem(%item, %orbit, %image, %plat, %gold, %silver, %copper)
{
    %x = $Pref::Player::PosBuy + 0;
    %y = 0; 
    %pos = %y SPC %x;
    %ttip = (%plat @ "P" SPC %gold @ "G" SPC %Silver @ "S" SPC %copper @ "C");  
	%BuyWindowView = new GuiBuyView() {
		profile = "GuiDefaultProfile";
		horizSizing = "relative";
		vertSizing = "relative";
		position = %pos;
		extent = "50 50";
		minExtent = "8 2";
		visible = "1";
		helpTag = "0";
		cameraZRot = "0";
		forceFOV = "0";
		orbitDist = "1";
		tooltip = %ttip;		
      	};
    %x2 = $Pref::Player::PosBuy + 32;
    %y2 = 60;      	
    %pos2 = %y2 SPC %x2; 	
	%BuyWindowText = new GuiMLTextCtrl() {
         Profile = "GuiMLTextProfile";
         HorizSizing = "Relative";
         VertSizing = "Relative";
         Position = %pos2;
         Extent = "150 14";
         MinExtent = "8 2";
         Visible = "1";
         lineSpacing = "2";
         allowColorChars = "1";
         maxChars = "-1";
         text = "Item";
      };
	BuyWindow.add(%BuyWindowView);
	BuyWindow.add(%BuyWindowText);	
	%BuyWindowView.setObject(%Item,%image,"", 0);
	%BuyWindowView.orbitdist = %orbit;
	%msg = (%item);
    %BuyWindowText.text = %msg;
    %BuyWindowText.setText(%msg);	
    $Pref::Player::PosBuy = ($Pref::Player::PosBuy + 50);
    $Pref::Player::NumberBuy = $Pref::Player::NumberBuy++; 
}

This works fine, except after 4 items (taking us to the extent of 200 of the GUIScrollCtrl, the rest are added but the scroll bar, set to "AlwaysOn" never shows up so it won't scroll to the 5th, 6th etc.

Is there anyway to force a refresh of the GuiScrollCtrl or to do some other magic which makes the container recognise that there is stuff it should be scrolling to?

As ever, any help much appreciated.

Regards

Graham Evans

#1
01/02/2007 (7:14 am)
Hi all:)

sorry to bump but this is still bugging me and I can't find any answers.

If you have any, I would love to hear them, otherwise I will have to do the usual lateral thinking and find another solution:)

Regards

Graham