Interacting with Widgets

Interacting with Widgets

Interacting with Widgets

Widgets on their own will handle user interactions. However, we need to be able to respond to certain events in code when they happen. We may need to know when the OK button is pressed, or a checkbox is checked/unchecked. If you examine the sample project, look at the obj_MainUI object and look at its user_defined(0) code to see how it would work. It is hard to explain, but the youtube video of sample menu will show you how to do this.Depending on the form, we may need to just respond to the OK/Cancel Buttons..or we may have to respond to each individual widget. The choice is yours depending on the current form.All widgets will call user_event(0) when they are ‘changed’, you must create your own EventObject that will handle all these events from all the controls. You can decide to have a persistent object for your entire MenuGUI, or you can have a separate EventObject for each room. For each control you need monitor, you need to set the uiEventObject to your object, and set the uiControlName so that your object knows who was calling the event.

 

uiEventObject=obj_my_MainUI;
uiControlName=’weapon_listbox’;

All that you do now is on your EventObject, add a user_event(0) and handle all calls to it. Using the “other” is how you know who which widget called your object. Like this: If other.uiControlName=’OKbutton’ then xxxxx;

You may also like...