These pages refer to legacy Hydra and Lycia 1 features.

The functionality described here does not embrace all the functionality provided by Lycia 3.

If you use Lycia 3, please, turn to other sections of this online documentation.

 

Check boxes

Description: C:\Users\user\Desktop\7.png

Check boxes are used for making binary choices and each check box relates to a single variable. Unlike radio buttons, where they are used in groups, it is possible to select all or any of the options.

The programmer can specify the value that should be written to the underlying variable when checking and un-checking this box. It should also be noted that if the value of the underlying variable is neither of the two values, it will show not ticked but will not modify this value by default. The user still needs to select the box to change the value of the variable.

Alternatively, you can use a check box to trigger key and action events, instead of writing values to variables directly.  This may be required if you want to execute some program logic straight after the user has clicked the check box.

In ASCII mode, check boxes display as normal fields.

Attributes Syntax

<tag> =    <field>,

config=<checked value> <un-checked value> <Label Text>,

widget="check";

Thiss code sample creates a check box.

ATTRIBUTES

f_check=formonly.f_check,

     config="1 0 {Checked is 1 and not checked is 0}",

     widget="check";

Properties

widget

The name of the check box field widget is ‘check’.

widget = "check"

class

If no class attribute is specified (or the attribute class=default), it will behave like a normal data check box.

Class="default"

If the attribute class=key is specified, it behaves like a button with two key or action events.

Class="key"

config

For a normal (class=default) check box, the configuration string consists of the checked value, unchecked value and the check box text (the label next to the check box).

config="1 0 {Check box label text}"

If you do not set a default value, the check box is set to a null string when processing an input statement with defaults.

 

When clicking the check box, the value in the field is changed, however any AFTER FIELD logic associated with the field will not be triggered unless the user attempts to leave the field either by pressing ‘tab’ or by selecting another field with the mouse.

 

For a ‘KEY’ or ‘Action’ check box (class=key), the configuration string consists of the event to be fired when the box is checked, the event for non-checked and the check box text (the label next to the check box).

config="F1 F2 {Check box label text}"

Description: C:\Users\user\Desktop\FormsScreenShots\ch_box1.jpg

Invoking a Key Code or Action (class="key")

You can overcome the issue of returned string length and after field statements by invoking a single key code or action event name instead of returning a string.  To do this you will need to use the code

class="key"

You need to add this to the attribute section of the form file, where the check box is declared.

To define the key presses use the same config syntax as when you use normal field values.

config="F1 F2 {Send E-Mail now ?}

You can also enable or disable check boxes that use the key class within 4GL programs. The code sample below shows the lines needed to firstly enable and secondly to disable the check box called myButton:

DISPLAY "!" TO myButton

DISPLAY "*" TO myButton

How to Create a Check Box

Example 1

Project: forms
Program: fm_field_widget_check1 …~2 , …~simple and …~event

 

.per form:

DATABASE formonly

 

SCREEN

{

 Simple\g \gCheck\g \gBox\g \gwidget\g \gexample     

                                     

 [f_check                            ]

}

 

ATTRIBUTES

f_check=formonly.f_check,

             config="1 0 {Checked is 1 and not checked is 0}",

             widget="check";

 

INSTRUCTIONS

 

DELIMITERS "[]"

 

Description: C:\Users\user\Desktop\FormsScreenShots\ch_box2.jpg

Example 2:

# Define a checkbox with the label ‘receive mail’.

#If the check box is ticked, the value 1 should be written

#into the record variable contact.rec_mail, otherwise ‘0’

#should be written. The default value should be ‘0’.

 

f0=          contact.rec_mail,

config="1 0 {Receive Mail}",

widget="check",

default=0;

 

Example 3:

# Define a checkbox with the label ‘Next Action’.

#If the check box is ticked, the key press F1 should be

#sent, when unticked, the key press F2 is sent

 

f0=          formonly.nextAction,

config="F1 F2{Next Action}",

widget="check",

class="key";

 

Example 4:

# Define a checkbox with the label ‘Next Action’.

#If the check box is ticked, the action event ‘act_print_text’ should be

#sent, when unticked, the action event ‘act_print_html’ is raised.

 

f0=          formonly.nextAction,

config="act_print_text act_print_html{Next Action}",

widget="check",

class="key";

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.