-
Notifications
You must be signed in to change notification settings - Fork 5
5.3 UI debugging
This window displays detailed data about the selected UI Control.
Here is the list of the informations that will be displayed from the UI Window.
-
Family
Search filter. “UI Control” menu will display only the UI Controls belonging to the selected Family. This menu is updated if a UI Control is clicked (check out the next Section for more info). -
Type
Search filter. ““UI Control” menu will display only the UI Controls belonging to the selected Type. This menu is updated if a UI Control is clicked (check out the next Section for more info). -
UI Control
List of all the UI Controls created in GUI. Can be filtered by Family and Type in order to make searching easier. -
H button
Show/hide temporarily the selected UI Control. -
Value
Current value of the selected UI Control. -
UI
ID UI ID of the selected UI Control. -
Persistent
“Y” means that the selected UI Control was set as PERSISTENT in its declaration. If it was set as NOT_PERSISTENT in its declaration, “N” will be displayed. -
Ctrl
No. Number of the selected UI Control. Linked to the order you declared each UI Control in your Script. -
Pos
. X Current position of the selected UI Control. Can be adjusted in realtime to verify the UI Control's position. Any change made here will NOT be saved: when the desired value is set, it has to be manually copied to the Script. -
Pos
. Y Current position of the selected UI Control. Can be adjusted in realtime to verify the UI Control's position. Any change made here will NOT be saved: when the desired value is set, it has to be manually copied to the Script. -
Width
Current width of the selected UI Control. Can be adjusted in realtime to verify the UI Control's width. Any change made here will NOT be saved: when the desired value is set, it has to be manually copied to the Script. -
Height
Current height of the selected UI Control. Can be adjusted in realtime to verify the UI Control's height. Any change made here will NOT be saved: when the desired value is set, it has to be manually copied to the Script.
There are two ways to enable debugging for a certain UI Control:
• Manual selection: choose the desired UI Control from ““UI Control” dropdown menu. You can filter out the results by Family and Type in order to gain easier access to the desired UI Control.
• Smart selection: click on the desired UI Control. This is NOT applicable on non-clickable UI Controls, such as Labels, UI Meters etc. You need to use some additional code within each ui_control callback to enable this.
Let's see in details these two solutions.
The Manual selection can be handled by using three dropdown menus, Family, Type and UI Control.
Family and Type are search filters: they can be used to include or exclude specific UI Controls. This should help handling very large scripts with many UI Controls. UI Control is populated by all the UI Controls created with Koala GUI functions (see Part II of Koala's Manual for more info).
Each UI Control is displayed by its variable name. You can load any UI Control's current data by selecting it from this menu.
The Smart selection allows you to automatically select any clickable UI Control by just clicking on it.
In order to enable the Smart selection on a specific UI Control, you need to include the following piece of code inside its on ui_control callback:
DEBUG.on_ui_control(<name>)
If this line of code is found, each time the value of the UI Control is changed the Realtime Debugger will display the data of that particular UI Control.
Here is an example of this instruction used inside a macro to reduce the amount of lines of code to be written. Pay attention to the usage of the Wild Card symbol inside the macro. Each time a Knob is touched, the Realtime Debugger will display its data. This is the right way to use this function. Any other usage may return incorrect values.
SET_CONDITION(ENABLE_DEBUG)
import "Koala/Koala.ksp"
on init
***activate_logger("/path_to_log_file/log.nka")***
Koala.init
create_family(FAMILY_1, 1)
create_knob(knob_1, FAMILY_1, ...)
create_knob(knob_2, FAMILY_1, ...)
create_knob(knob_3, FAMILY_1, ...)
end on
macro knob_c(#n#)
on ui_control (knob_#n#)
DEBUG.on_ui_control(knob_#n#)
end on
end macro
knob_c(1)
knob_c(2)
knob_c(3)
Every time you click on a UI Control, the Smart selection will update Family and Type menu to match the selected UI Control.
One of the most annoying operations when dealing with KSP and UI Controls is placing them in the right position on your GUI. With custom GUI design, this can be a pain in the neck in terms of time and useless effort needed to make things work.
Koala Realtime Debugger allows the developer to preview any change in terms of UI Control's position and size. Pos. X, Pos. Y, Width and Height can be used for this purpose. Any of these changes will not be saved within the Script, so when you find the desired position and size it's recommended to immediately insert these data inside the Script.