SETITEM


7.8.5, PLBCMP GUI Only

square.png Objects

 

The SETITEM instruction changes the name or value of an object item. The old information is replaced with the new information. It uses one of the following formats:

 

(1)

[label]

SETITEM

{object},{item},{data}

(2)

[label]

SETITEM

{dialog},{dialog-no},{item},{data}

 

Where:

label

Optional. A Program Execution Label.

object

Required. A previously defined and created object or pointer to an object that receives the name or value.

item

Required. A Numeric Variable, numeric literal, or Expression that indicates the item within the object to receive the name or value.

data

Required. A previously defined Character String Variable or Numeric Variable that contains the new name or value for the object.

dialog

Required. A previously defined and created DIALOG object or pointer to a DIALOG object containing an object to receive the name or value.

dialog-no

Required. A Numeric Variable, numeric literal, or Expression that indicates the item within the dialog acted upon.

Flags Affected: NONE

Note the following:

  1. If {data} is a character variable or literal, the following action occurs depending on the type of object:

  2.  

    Object

    Action

    COMBOBOX, BUTTON, CHECKBOX, POPUPMENU or RADIO

    The name of the object is changed to the logical contents of {data}. Multiple logical records or items may be specified for a COMBOBOX when each is terminated by a hexadecimal 7F character or the value defined by the SETMODE *USE7F instruction. For a COMBOBOX, if {item} is a negative one (-1), the current selection is set to the item matching {data} (9.3A) If {data} is null, the COMBOBOX is set to no selection.

    CHECKGRP or RADIOGRP

    The name of the object specified by {item} is changed to the logical contents of {data}.

    DATALIST, FLOATMENU, MENU or SUBMENU

    The text of the object specified by {item} is changed to the logical string of {data}. Multiple logical records or entries may be specified for a DATALIST when each is terminated by a hexadecimal 7F character or the value defined by the SETMODE *USE7F instruction.

    EDITTEXT,EDITNUMBER,
    or
    EDITDATETIME

    The entire text of the object is changed to the logical string of {data} after removing trailing spaces when {item} is zero (0). The selected text of the EDITTEXT is replaced when the value of {item} is one. No changes are made if {item} is any other value.

    STATTEXT,LABELTEXT

    The text of the object is changed to the logical string of {data} when {item} is zero.

    TABCONTROL

    The label of the tab identified by {item} is changed to the logical string of {data}. If {item} is not within the range of one to the number of tabs inclusive, no change is made.

     

  3. If {data} is a numeric variable or decimal constant, the following action occurs depending on the type of object:

  4.  

    Object

    Action

    BUTTON, CHECKBOX or RADIO

    The value of the object is changed to the Boolean value (Not Set if zero, Set if any other value) of {data}.

    CHECKGRP

    The value of the object specified by {item} is changed to the Boolean value (not set if zero, set if any other value) of {data}.

    COLOR

    The entire twenty-four bit color is changed to the value of {data} if {item} is zero. The red component is changed to the value of {data} if {item} is one. The green component is changed to the value of {data} if {item} is two. The blue component is changed to the value of {data} if {item} is three.

    DATALIST

    The currently selected entry is changed to the item with the same number as the value of {data}. Any currently selected item is deselected when the value of {data} is zero. If the MULTISELECT property is set, {item} selects the entry modified and {data} specifies the state of the entry. A value of zero deselects the entry and any non-zero value selects the entry. If {item} and {data} are both zero, all items are deselected. If {item} is zero and {data} is not zero, all items are selected. If {item} is not zero and {data} is zero, the entry corresponding to the value of {item} is deselected. If {item} is not zero and {data} is not zero, the entry corresponding to the value of {item} is selected.

    DIALOG

    The {dialog-no} operand contains the number of the dialog item. The action performed on the dialog item follows the same rules as an object variable of the same type. When an icon is used in a DIALOG, the icon may be changed by making {data} a numeric variable or decimal constant indicating the icon resource number.

    EDITTEXT,EDITNUMBER,
    or
    EDITDATETIME

    When {item} is one, the starting position of the selected text is changed to the value of {data}. When {item} is two, the ending position of the selected text is changed to the value of {data}. The selected text will always be brought into view for the object. If the starting and ending position is set to the same value, the cursor is moved to the specified position but no text is selected.

    HSCROLLBAR, SLIDER or VSCROLLBAR

    When {item} is zero, the current position of the slide button is changed to the value of {data}. An {item} value of one changes the minimum value and a value of two changes the maximum value. When {item} is three, the page shift value is changed.

    For SLIDER objects running under the Web Server, the following apply. When {item} is zero, the current position of the slide button is changed to the value of {data}. An {item} value of one changes the minimum value and a value of two changes the maximum value. When {item} is three, the page shift value is changed. An {item} value of four causes the page 'step' value to be changed. See below for additional information.

    MOVIE

    {item} must be a one and {data} may be one of the following values: zero means to stop the movie and reset back to the beginning; one means to start the movie from the current position; two means to pause the movie and leave at the current position. A start after a pause continues the movie from the paused point.

    COMBOBOX, POPUPMENU

    The currently selected entry is changed to the item with the same number as the value of {data}. If {data} is zero, the edit box is cleared.

    RADIOGRP

    The value of the object specified by {item} is changed to the Boolean value (not set if zero, set if any other value) of {data}. All of the objects are turned off when the value of {item} is zero.

    TIMER

    The time-out value is changed to the value of {data}. The value is tenths of a second.

    PROGRESS

    When {item} is zero, the percentage is changed to the value of {data} within the range of zero to one hundred inclusive.

    TABCONTROL

    When {item} is zero, the currently selected tab number is changed to the value of {data}. If {data} is not within the range of one to the number of tabs inclusive, no change is made.

     

  5. A value of negative one (-1) for the item number sets the current selection for the COMBOBOX to the item string that matches the DIM input string. If the SETITEM output DIM is NULL and the item number is negative one, the COMBOBOX is set to no selection.

  6. No action occurs if the item number is not valid.

  7. An object must be CREATEd before using SETITEM. If this is not done, a runtime error of O105 is generated.

  8. If insufficient memory is available to perform the operation, a runtime error of O106 is generated.

  9. International users should refer to the PLB_LOCALE runtime keyword for additional information.

  10. The PL/B Web Server SLIDER is implemented using the jQuery SLIDER object. The PWS SLIDER supports a jQuery SLIDER 'step' option which is described as follows:
     

  11. "Determines the size or amount of each interval or step the slider takes between the min and max. The full specified value range of the slider (max - min) should be evenly divisible by the step."

 

 

See Also: Example Code, GETITEM, Object Instructions

 



PL/B Language Reference SETFOCUS SETPROP