User Tools

Site Tools


4rpl:commands:func_uicallback

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
4rpl:commands:func_uicallback [2021/01/14 15:51] virgilw4rpl:commands:func_uicallback [2025/02/14 14:57] (current) – external edit 127.0.0.1
Line 2: Line 2:
 <=[[4rpl:start| Index]] <=[[4rpl:start| Index]]
  
-":_UICallback" is invoked whenever a control panel UI element is changed. The control panel UI elements for a unit are part of its UI definitions in the CMod settings. Whenever a UI element is changed by the player, any script on the unit with :_UICallback (note the underscore) will have the function called.+====== :_UICallback ======
  
-There is an implicit variable named "_DATA" that is available for use when the callback is made. For this callback, _DATA is an int that points to the UI slot that was changed. 0 refers to the first slot, 1 the 2nd, etc.+===== Description =====
  
-See: [[4rpl:commands:getunituistate]] for an example and further information+":_UICallback" is invoked whenever a control panel UI element is changed. The control panel UI elements for a unit are part of its UI definitions in the CMod settings. Whenever a UI element is changed by the player, any script on the unit with **:_UICallback** (note the underscore) will have the function called. 
 + 
 +There is an implicit variable named "_DATA" that is available for use when the callback is made. For this callback, **_DATA** is an int that points to the UI slot that was changed. 0 refers to the first slot, 1 the 2nd, etc. 
 + 
 +See: [[4rpl:commands:getunituistate|GetUnitUIState]] for further information 
 + 
 +===== Example ===== 
 + 
 +<code 4rpl> 
 +#:_UICALLBACK is called on any script (if present) whenever a UI widget is changed. 
 +:_UICALLBACK 
 +   #The _DATA is an int that points to the slot that was just changed 
 +   GetUnitUIState(self <-_DATA) ->slotState 
 +   printallsp("UICALLBACK: " <-slotState) 
 +</code>
  
4rpl/commands/func_uicallback.1610639514.txt.gz · Last modified: 2025/02/14 14:56 (external edit)