Command PV SET CELL CONTROL

4D View

PV SET CELL CONTROL

version 6.8


PV SET CELL CONTROL (area; column; row; type; varName; method; title)

ParameterTypeDescription
areaLongint4D View area
columnLongintCell column number
rowLongintCell row number
typeIntegerControl type
varNameStringName of control management variable
methodStringCallback method name
titleStringControl title

Description

The PV SET CELL CONTROL command places a "control" in the cell set by column and row.

A control is a button, check box, radio button, drop-down list, or combo box type object contained within a cell.

If a control was already inserted in the cell, it is deleted and replaced by the new control, whatever its type.

type indicates the control type (among the five listed above) contained in the cell. To set this parameter, use the PV Control constants theme.

varName is the variable associated with the control. Pass the name of the array containing the values to display (for drop-down list and combo box control types).

method contains the name of the callback method linked to the control. For more information on callback methods, refer to the PV Area, Introduction section.

title contains the label of the button, check box, etc.

Examples

The following methods allow visualizing different types of controls:


• Standard button in C3:

   C_LONGINT(vStandardButton)  `Standard button
     PV SET CELL CONTROL (Area;3;3;pv control push button ;"vStandardButton";"CallbackButton";"Button")

        `CallbackButton method
   C_LONGINT($1)  `4D View area
   C_LONGINT($2)  `Column number
   C_LONGINT($3)  `Row number
   C_POINTER($4)  `Pointer to call object
   ALERT("Control from method: "+Current method name)

• Radio buttons in E3, E4, E5:

   C_LONGINT(vRadio1;vRadio2;vRadio3)  `Radio buttons
   vRadio1:=1
   vRadio2:=0
   vRadio3:=0
   PV SET CELL CONTROL (Area;5;3;pv control radio button ;"vRadio1";"CallbackRadio";"Day")
   PV SET CELL CONTROL (Area;5;4;pv control radio button ;"vRadio2";"CallbackRadio";"Month")
   PV SET CELL CONTROL (Area;5;5;pv control radio button ;"vRadio3";"CallbackRadio";"Year")
        `CallbackRadio method
   C_LONGINT($1)  `4D View area
   C_LONGINT($2)  `Column number
   C_LONGINT($3)  `Row number
   C_POINTER($4)  `Pointer to call object
   C_STRING(6;$Value)
   Case of 
        : ($4=(->vRadio1))
         vRadio2:=0
             vRadio3:=0
             $Value:="Day"
         : ($4=(->vRadio2))
             vRadio1:=0
             vRadio3:=0
             $Value:="Month"
            : ($4=(->vRadio3))
             vRadio1:=0
             vRadio2:=0
             $Value:="Year"
   End case 
   PV SET CELL TEXT VALUE ($1;($2+1);3;$Value)

• Check boxes in E7, E8, E9:

   C_LONGINT(vCheckBox1;vCheckBox2;vCheckBox3)  `Boxes to check
   vCheckBox1:=0
     vCheckBox2:=0
     vCheckBox3:=0
    PV SET CELL CONTROL (Area;5;7;pv control check box ;"vCheckBox1";"CallbackCheckBox";"Beginner")
     PV SET CELL CONTROL (Area;5;8;pv control check box ;"vCheckBox2";"CallbackCheckBox";"Intermediate")
     PV SET CELL CONTROL (Area;5;9;pv control check box ;"vCheckBox3";"CallbackCheckBox";"Expert")
        `CallbackCheckBox method
   C_LONGINT($1)  `4D View area
   C_LONGINT($2)  `Column number
   C_LONGINT($3)  `Row number
   C_POINTER($4)  `Pointer to call object
   C_TEXT($Value)
   If (vCheckBox1=1)
        $Value:="Beginner"
   End if 
   If (vCheckBox2=1)
        If ($Value#"")
             $Value:=$Value+" + "
        End if 
        $Value:=$Value+"Intermediate"
   End if 
   If (vCheckBox3=1)
        If ($Value#"")
             $Value:=$Value+" + "
        End if 
        $Value:=$Value+"Expert"
   End if 
   PV SET CELL TEXT VALUE ($1;($2+1);7;$Value)

• Drop down list in C5:

   ARRAY TEXT(DropdownListArray;5)  `For drop-down list
   DropdownListArray{1}:="Monday"
     DropdownListArray{2}:="Tuesday"
     DropdownListArray{3}:="Wednesday"
     DropdownListArray{4}:="Thursday"
     DropdownListArray{5}:="Friday"
     DropdownListArray:=3  `Default to Wednesday
     PV SET CELL CONTROL (Area;3;5;pv control drop down ;"DropdownListArray";"CallbackDropList";"")
        `CallbackDropList method
   C_LONGINT($1)  `4D View area
   C_LONGINT($2)  `Column number
   C_LONGINT($3)  `Row number
   C_POINTER($4)  `Pointer to call object
   PV SET CELL TEXT VALUE ($1;3;6;DropdownListArray{DropdownListArray})

• Combo box in C7:

   ARRAY TEXT(ComboArray;5)  `For combo box list
   ComboArray{1}:="Monday"
    ComboArray{2}:="Tuesday"
     ComboArray{3}:="Wednesday"
     ComboArray{4}:="Thursday"
     ComboArray{5}:="Friday"
     ComboArray:=5  `Default to Friday
     PV SET CELL CONTROL (Area;3;7;pv control combo box ;"ComboArray";"CallbackCombo";"")
        `Method: CallbackCombo
   C_LONGINT($1)  `4D View area
   C_LONGINT($2)  `Column number
   C_LONGINT($3)  `Row number
   C_POINTER($4)  `Pointer to call object
   PV SET CELL TEXT VALUE ($1;3;8;ComboArray{0})

See Also

PV GET CELL CONTROL, PV Get cell value type.

Constants

PV Control theme.