Often it is necessary to execute the code before displaying the main program window.
Example - loading previously entered settings from the file and installing them in the controls.
Added block INITDIALOG
The code in it is executed first before creating a dialog box and controls.
It has access to all variables and functions in the main body of the program.
syntax
INITDIALOG
{
// Then add the code that will be executed before running the graphical shell ...
}
You can find it in the right mouse button menu - interface creation - code block running to the interface.
Important
Variables declared in this manner in the main code
int a=5
will not have those values ??that they were assigned at the time of declaration, since the code in INITDIALOG will be executed before a becomes 5.
Therefore, if a must be used in INITDIALOG, you must declare it in the main code, and assign it to it in INITDIALOG
Example
Цитата: int a;
INITDIALOG
{
a=5;
messagebox (a);
}
The unit can be located anywhere
Example:
Цитата: messagebox ("here is the main code.");
INITDIALOG
{
// Then add the code that will be executed before running the graphical shell ...
int Year, Month, DayOfWeek, Day, Hour, Minute, Second, Milliseconds;
getlocaltime (Year, Month, DayOfWeek, Day, Hour, Minute, Second, Milliseconds);
sendcontrol (STATIC_0, "Current time");
sendcontrol (CHECK_0, 1); // Put the daw
sendcontrol (EDIT_0, format (Hour) + ":" + format (Minute) + ":" + format (Second));
sendcontrol (COMBO_0, 0, "Now this is the point"); // change the name of the item in the list by the number
sendcontrol (COMBO_0, "Line 2 Selection", "And this one by name"); // change the name of the item in the list by name
messagebox ("Control data changed");
}
CREATE_INTERFACE
{
DIALOG "Window name" 237 180 // SizeX SizeY
BUTTONSCRIPT "Run" 125 121 100 25 // PositionX PositionY SizeX SizeY
// Adding Controls ......
STATIC_0 "Static text" 10 10 90 18 // PositionX PositionY SizeX SizeY
EDIT_0 "Default text" 105 8 120 18 // PositionX PositionY SizeX SizeY
CHECK_0 0 /* Disabled */ "Enable option" 10 130 105 18 // PositionX PositionY SizeX SizeY
COMBO_0 0 /* Initial selection */ "Line selection 1" | "Line 2 Selection" | "Line selection 3" 10 40 212 200 // PositionX PositionY SizeX SizeY_ drop-down list
}
The function sendcontrol for lists is improved.
Now you can change the names in the lists.
Цитата: sendcontrol (COMBO_0, 0, "Now this is the item"); // change the name of the item in the list by the number
sendcontrol (COMBO_0, "Select line 2", "And this one by name"); // change the name of the item in the list by name
----- The Visual Code Editor is Kibor. Creating bots without knowledge of programming.
Learning function for recognizing text.
----- |