-
Notifications
You must be signed in to change notification settings - Fork 0
Class Controls
Kristian Virtanen edited this page Oct 28, 2024
·
4 revisions
The Controls class provides functionality for creating and managing UI elements (such as buttons and textboxes) within the GraphicsWindow. It allows you to add, move, resize, and remove these controls, as well as track user interactions such as button clicks or text input.
It also manages error handling through the LastError property, which stores the most recent error message in case of a failed operation.
-
Description: Returns the name of the last clicked button, or
nullif no button has been clicked. -
Example:
"Button1" - Differences from orig. SB: none.
-
Description: Stores the last error message, if any operation fails, including a timestamp in
yyyy-MM-dd HH:mm:ssformat. -
Example:
"2024-10-16 14:30:00: Graphics window is not initialized." - Differences from orig. SB: Not available at original SB.
-
Description: Returns the name of the last text box that had text typed into it, or
nullif no text was typed. -
Example:
"TextBox1" - Differences from orig. SB: none.
-
Description: Adds a button to the
GraphicsWindowat the specified position (left,top) and returns the name of the button. -
Parameters:
-
caption: The text displayed on the button. -
left: The horizontal position of the button. -
top: The vertical position of the button.
-
-
Returns: The name of the button (e.g.,
"Button1"), ornullif an error occurred. -
Example:
Controls.AddButton("Submit", 100, 200) - Differences from orig. SB: none.
-
Description: Adds a single-line text box to the
GraphicsWindowat the specified position (left,top) and returns the name of the text box. -
Parameters:
-
left: The horizontal position of the text box. -
top: The vertical position of the text box.
-
-
Returns: The name of the text box (e.g.,
"TextBox1"), ornullif an error occurred. -
Example:
Controls.AddTextBox(100, 200) - Differences from orig. SB: none.
-
Description: Adds a multi-line text box to the
GraphicsWindowat the specified position (left,top) with default size, and returns the name of the text box. -
Parameters:
-
left: The horizontal position of the text box. -
top: The vertical position of the text box.
-
-
Returns: The name of the text box (e.g.,
"MultiLineTextBox1"), ornullif an error occurred. -
Example:
Controls.AddMultiLineTextBox(100, 200) - Differences from orig. SB: none.
-
Description: Adds a multi-line text box to the
GraphicsWindowat the specified position with a custom size, and returns the name of the text box. -
Parameters:
-
left: The horizontal position of the text box. -
top: The vertical position of the text box. -
width: The width of the text box. -
height: The height of the text box.
-
-
Returns: The name of the text box, or
nullif an error occurred. -
Example:
Controls.AddMultiLineTextBoxWithSize(100, 200, 300, 150) - Differences from orig. SB: Not available at original SB.
- Description: Returns the text from the specified text box.
-
Parameters:
-
textBoxName: The name of the text box to retrieve text from.
-
-
Returns: The text in the text box, or
nullif the text box was not found. -
Example:
Controls.GetTextBoxText("TextBox1") - Differences from orig. SB: none.
- Description: Sets the text in the specified text box.
-
Parameters:
-
textBoxName: The name of the text box. -
text: The text to set in the text box.
-
-
Returns:
trueif successful,falseif the text box was not found or an error occurred. -
Example:
Controls.SetTextBoxText("TextBox1", "Hello World!") - Differences from orig. SB: none.
-
Description: Moves the specified control to the given coordinates (
x,y). -
Parameters:
-
controlName: The name of the control to move. -
x: The new horizontal position. -
y: The new vertical position.
-
-
Returns:
trueif the control was successfully moved,falseif the control was not found or an error occurred. -
Example:
Controls.Move("Button1", 150, 250) - Differences from orig. SB: none.
- Description: Sets the size of the specified control.
-
Parameters:
-
controlName: The name of the control. -
width: The new width of the control. -
height: The new height of the control.
-
-
Returns:
trueif the control size was successfully set,falseif the control was not found or an error occurred. -
Example:
Controls.SetSize("Button1", 100, 50) - Differences from orig. SB: none.
-
Description: Removes the specified control from the
GraphicsWindow. -
Parameters:
-
controlName: The name of the control to remove.
-
-
Returns:
trueif the control was successfully removed,falseif the control was not found or an error occurred. -
Example:
Controls.RemoveControl("Button1") - Differences from orig. SB: none.