Latest Additions: Difference between revisions
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
Listboxes can also include | Listboxes can also include | ||
<code>FUNCTION UI_OBJ_RENDER_ITEM(x,y,width,height,pass,flags)</code> | <code>FUNCTION UI_OBJ_RENDER_ITEM(x,y,width,height,pass,flags, item)</code> | ||
which operates in the same way but for each listbox item. The flags param has bits set for selection (bit 0) and mouseover (bit 1). | which operates in the same way but for each listbox item. The flags param has bits set for selection (bit 0) and mouseover (bit 1), item is the index of the item in the listbox, name is the UI object name. | ||
= Listboxes: Multiple Selection = | = Listboxes: Multiple Selection = |
Revision as of 16:40, 2 February 2016
Custom UI Object Rendering (inc Listbox Items)
Individual UI objects can now have their own scripts attached, including their own rendering callbacks. As before the rendering callback is of the form
FUNCTION UI_OBJ_RENDER(x,y,width,height,pass)
Where pass is 0/1 for pre/post normal control rendering.
Listboxes can also include
FUNCTION UI_OBJ_RENDER_ITEM(x,y,width,height,pass,flags, item)
which operates in the same way but for each listbox item. The flags param has bits set for selection (bit 0) and mouseover (bit 1), item is the index of the item in the listbox, name is the UI object name.
Listboxes: Multiple Selection
You can enable multiple selection for listboxes with the MULTISELECT tag in their UI definition. Then use
//return 1 if the specified item is selected, zero otherwise IsUIListboxItemSelected(object, index) //returns the number of items in a listbox GetUIListboxCount(object)
to interrogate the listbox.
Note: This means that it is possible to get UI script triggers from listboxes which are actually a CTRL+ event which unselects the item.
Scripting: GetWorkString
You can now use GetWorkString on the RHS of an assignment expression, e.g.
char myString[32] ;
myString = GetWorkString() ;
The contents will be safely truncated to the source string's size.
3DVIEW UI Control
Creates a 3D viewport into which you can load 3D models for viewing. The COLOUR tag for this control sets the background clear colour (use zero for a transparent background, FF000000 for black).
Script commands to control this are:
//if filename starts with # then defaults to standard unit loading paths. UIObject3DLoad(objectName, filename, [texturePath]) //automatically set the zoom and camera origin to the size of the currently loaded object UIObject3DAuto(objectName) //set the origin position and vertical angle of the camera. SetUIObject3DCamera(objectName, x,y,z,angle,[zoom]) //set the options for the view. 0 for off, nonzero for on. SetUIObject3DOptions(objectName, allowZoom, allowHorizontalRotate, allowVerticalRotate)