====== Set_Property (OI 9.x) function ======
==== Description ====
Sets properties in OpenInsight objects such as controls and windows.
==== Syntax ====
//existingprop// = **Set_Property**(//objectname//, //property//, //value//[, //auxparameter//])
Note: There is also special notation that can be used for properties in window event code. See [[property_shorthand_notation_in_window_event_code|Property Shorthand Notation in Window Event Code]].
==== Parameters ====
To set multiple properties in one call to Set_Property, pass @RM-delimited lists for //objectname, property//, and //value//. This is faster than individual calls to Set_Property().
==== See Also ====
[[property_shorthand_notation_in_window_event_code|Property Shorthand Notation in Window Event Code]]. Also, for more information about properties, refer to [[chapter_properties|Chapter 4: Properties]], as well as the //Guide to Application Development//. Also, [[get_property|Get_Property()]]
==== Examples ====
Example: Setting The Title
* set the title of the current window
Set_Property (@window, "TEXT", Title)
Example: Setting Multiple Properties
Below is a subroutine, called Set_Bulk_Properties, which allows multiple properties to be set with one call to Set_Property():
subroutine set_bulk_properties (Ctrls, Props, Vals)
declare subroutine set_property
* Ctrls [in] - comma and/or @rm-delim'd control ids
* Props [in] - comma and/or @rm-delim'd property names
* Vals [in] - @rm-delim'd values
SetProps:
swap "@" with @window in Ctrls
convert "," to @rm in Ctrls
convert "," to @rm in Props
Set_Property(Ctrls, Props, Vals)
return
This subroutine, called in a window context (such as the Click event of a button), will set the window background color to yellow (RGB(255,255,0)), the Button_OK button font to Tahoma, and the Button_OK button text to OK, with one call to Set_Property().
declare subroutine set_bulk_properties
declare function rgb
controls = @window : @rm : @window :".Button_OK" : @rm : @window :".Button_OK"
propnames = 'BACKCOLOR' : @rm : 'TEXT' : @rm : 'FONT'
values = rgb(255,255,0) : @rm : 'OK' : @rm : 'Tahoma'
set_bulk_properties( controls, propnames, values)