class control

superclass(es) window
subclass(es) button - checkBox - comboBox - customControl - editControl - groupBox - label - listBox - radioButton - scrollBar 
description The control class is an abstract base class for all standard controls. The class extends the window class with methods to set and get a control identifier and to use the tab key to iterate through a series of controls.
see also panel - font

tasks

Because the control class is an abstract class it is not possible to create an instance of this class. Only instances can be created from derived control classes like checkBox.

Each control window can have a unique identifier, Trinc-Prolog ensures, while creating controls, that each instance automatically gets a unique identifier. The control identifier can be queried by the method controlID/1.

Control class instances all have two properties which can be used by an application to store extra information, these properties are never shown to the user. The two properties are an integer and a string. An application can use it store identifiers and/or atoms, Prolog clauses, etc. The methods for the setting/getting properties are: putProperties/2, properties/2, putIntegerProperty/1, integerProperty/1, putStringProperty/1 and stringProperty/1.

With the tab key it is possible to iterate through all the controls of a single window, the tab order is determined by the order of creation, the first created control is the first in the tab order. It is possible to remove (and insert) a control from (and into) the tab order with the method putTabStop/1.

The control class also has three methods to change the font used by a control for drawing text, these are putFont/1, putFont/3 and putFont/7.

methods

putControlID( Val )

func Set the control identifier of the control window.
pre The variable Val must contain an integer.
post The control identifier was set to the value that Val had.

controlID( Output )

func Get the control identifier of the control window.
pre TRUE.
post The control identifier value was unified with the Output variable.

putProperties( Integer, String )

func Store the values of the integer and string parameters. These values are stored inside the control and are never visible to the user. They are meant for the application so that it can associate hidden data with a control. For instance: the properties could be used if a button was pressed to get extra information about what to do with the click event of the button.
pre The parameter Integer must contain an integer and the String parameter must contain an atom.
post The values of the parameters were stored.

properties( OutputInteger, OutputString )

func Get the values of the integer and string properties of a control. These values are stored inside the control and are never visible to the user.
pre TRUE
post The values of the integer and string properties of the control were unified with the values of the OutputInteger and OutputString parameters.

putIntegerProperty( Integer )

func Store the value of the integer parameter as the hidden integer property of a control. This value is never visible to the user. It is meant for the application so that it can associate hidden data with a control.
pre The parameter Integer must contain an integer.
post The values of the parameters was stored.

integerProperty( OutputInteger )

func Get the value of the integer property of a control. The value is stored inside the control and is never visible to the user.
pre TRUE
post The value of the integer property of the control was unified with the value of the OutputInteger parameter.

putStringProperty( String )

func Store the value of the string parameter as the hidden string property of a control. This value is never visible to the user. It is meant for the application so that it can associate hidden data with a control.
pre The parameter Stringmust contain an integer.
post The values of the parameters was stored.

stringProperty( OutputString )

func Get the value of the string property of a control. The value is stored inside the control and is never visible to the user.
pre TRUE
post The value of the string property of the control was unified with the value of the OutputString parameter.

clearProperties( OutputString )

func Clear the integer and string properties of a control.
pre TRUE
post The integer property will have the value 0 and the string property will be empty.

ownerDraw( Output )

func Determine if the control window is an ownerdraw control.
pre TRUE.
post If the control is an ownerdraw window then the variable Output is assigned true, else it is assigned false.

putTabStop( YesNo )

func Insert or remove the control window from the tab order of control windows.
pre The variable YesNo must contain true or false.
post If the variable YesNo contained true then the control is part of the tab order sequence, else it was removed from the tab order sequence.

tabStop( Output )

func Determine if the control window is part of the tab order sequence of control windows.
pre TRUE.
post If the control is part of the tab sequence of control windows then Output is assigned true, else it is assigned false.

prevTaborder( Output )

func Get the control window that is previous in the tab order sequence of control windows.
pre TRUE.
post If there is a previous control in the tab order sequence then Output is assigned a reference to that previous control, if there is no previous control then no value is assigned to Output.

nextTaborder( Output )

func Get the control window that is next in the tab order sequence of control windows.
pre TRUE.
post If there is a next control in the tab order sequence then Output is assigned a reference to that next control, if there is no next control then no value is assigned to Output.

ctrl3DLook( Output )

func Check if a control draws itself in the 3D style or not?
pre TRUE
post If the control draws itself in a 3D style then true was unified with the parameter Output, else was false unified with Output.

putCtrl3DLook( YesNo )

func Determine if the control must draw itself in a 3D style or not.
pre The value of the parameter YesNo must be true or false.
post If YesNo was true then a control will draw itself in a 3D style, else not.

putFont( Font )

func Set the font to use by the control for drawing text.
pre The variable Font must refer to an instance of the class font.
post The control will use the contents of the variable Font for drawing text.

putFont( Height, Name, Bold, Italic, Strikethrough, Underline, clr(R, G, B) )

func Set the properties of the font to use by the control for drawing text. The height, name, bold, italic, strikethrough, underline and color properties of the font can be specified. The height is in pixels.
pre The variable Height must contain an integer value, the name variable must be a string. The variables Bold, Italic, Strikethrough and Underline must have boolean values (true or false). The variables R, G and B must be integers in the range [0, 255].
post The properties of the font were changed according to the specified parameters.

putFont( Height, Name, Bold )

func Set the height, name and bold properties of the font to use by the control for drawing text. The height is in pixels.
pre The variable Height must contain an integer value, the name variable must be a string. The variable Bold must have the boolean value true or false.
post The properties of the font were changed according to the specified parameters.

font( Output )

func Get the font used by the control to draw text.
pre TRUE.
post If the control uses a specific font separate from the default font then the font instance used is returned, else if the control uses the default font no value was assigned to the variable Output.