Author Topic: GUI Manipulation.  (Read 1108 times)

To be exact, I just want to edit the visibility, the bitmap value, size, and position values. I can't find the commands that do it and the ones I come up with do nothing.

Code: [Select]
%gui = myGuiElement;

%gui.visible = false;
%gui.setVisible(true);

%gui.setBitmap("bitmap.png");

%gui.extent = "100 100";
%gui.position = "10 30";

But setting the extent and position actually changes it?

Blockland's variables are for reading, not used in real time.

assume %gui is a GUIControl

%gui.getExtent(); returns the extent (width and height in pixels) of the GUIControl.

%gui.resize(); has some strange applications, because it has 4 arguments. The first two are the new position of the element, and the last two are the size (in pixels) of it.
To resize it, you'd use %gui.resize(0, 0, 100, 100); which would resize it to 100 pixels by 100 pixels, and move it to 0, 0.

%gui.resize(100, 100, getWord(%gui.getExtent(), 0), getWord(%gui.getExtent(), 1)); would move it to 100, 100 without changing the size. A GUIControl's position's origin is the top left, so it would move the top left of the element to 100, 100.


But setting the extent and position actually changes it?

Blockland's variables are for reading, not used in real time.
Yes, setting those values do change it. Every rendering tick they're read. The resize method is also valid but I very, very rarely see it in practice.

You use the resize method if you have auto-sized child controls that need to be updated