PDA

View Full Version : Resizing gui controls, not working



evenflcw
09-09-2008, 10:22 AM
According to the release notes of 2.7 or somesuch there is a size(<w>, <h>) method for controls that would allow you to alter the size of a control after it has been created. Usefull if you want your controls to resize as you resize the panel. But it seems to me this method is not there. I get the standard error that this object method is not recognized or somesuch.

Has anybody had better luck resizing controls after the fact in lscript? I've tried upping the version pragma but still no luck. User mistake or bug/feature omission?

Blochi
09-10-2008, 11:17 AM
I believe I had this working. Let me look this up....

Ahh .. .never mind, you might be right. <w> and <h> didn't work, instead I just re-issued a full ctlposition(x,y,w,h). That allows me to resize some controls, while making room by moving others that need to be aligned to the right window border.

Here are some relevant bits of code from my ImageEditorPlus (http://www.blochi.com/gfx/imgeditor_en.html):




....
reqbegin("Blochi's Image Editor Plus");
reqsize(320,430);

//______________________________________TABS________ ________________________

s1 = ctlsep(0,-1);
ctlposition(s1,0,45);

t1 = ctlimage("D:/LSCripts/ImageEdit/Logo_AppLauncher2.jpg",0,0);
ctlposition(t1,0,0,45,380);

c1 = ctltab(" Select Image "," Preferences "," About ");
ctlposition(c1,-10,48,337,22);

c2 = ctlinfo(130,115,"updatePreview");
ctlposition(c2,176,106,130,115);

c3 = ctllistbox("Images in Scene:",130,275,"lb_count","lb_name","lb_event");
ctlposition(c3,10,78,132,312);

c4 = ctlbutton(" Edit with "+but1,120,"launch1");
ctlposition(c4,176,230,130,28);

c5 = ctlbutton(" Edit with "+but2,120,"launch2");
ctlposition(c5,176,265,130,28);

...

reqresize("resize",320,430);

return if !reqpost();
reqend();

}

resize: w,h
{
dw = w - 320;
dh = h - 430;

ctlposition(c1,-10,48,337+dw,22);
ctlposition(c2,176+dw,106,130,115);
ctlposition(c3,10,78,132+dw,312+dh);
ctlposition(c4,176+dw,230,130,28);
ctlposition(c5,176+dw,265,130,28);
...
}




The beauty of this is, that it also works in previous versions... down to LW 8.

Blochi

evenflcw
09-11-2008, 05:07 AM
Great. Already got the suggestion of using ctlposition() instead from Walfridson. Didn't try it yet, so good to get a confirmation.

Thanks!

Gorbag
09-24-2008, 02:53 PM
I checked into this. The command was indeed added to LScript v2.7. However, due to its position in the object jump table, it was ambiguous with the general object size() method, and this latter method was being chosen instead. I've re-positioned methods in the jump table to disambiguate, and this Requester Control-specific method now triggers correctly. Should be fixed in build 1467 and later.

Sorry for the inconvenience.

:lwicon:

evenflcw
09-25-2008, 03:38 AM
Cool! Thanks for the status report!