1. General information
1.1. Description of the control
Schedule is a control designed to determine the time period from-to, which consists of either two text boxes “Schedule” and “to”, or two date pickers “Schedule” and “to”, and in both cases of the check box “From-To”. When it is created, a Space control and a JavaScript control are inserted as well.
1.2. Create a new control
- A new schedule can only be created from the edit form using the toolbar with controls.
- First, the position in which the new schedule is to be placed is determined by clicking the mouse in the edit form. This will highlight the selected position with a gray horizontal line. Then just click on the item “Schedule” in the toolbar of the edit form, confirm the question of creating a new schedule from multiple elements, and in the following dialog “2x TextBox / 2x DatePicker ?” select the type of controls used:
- 2x TextBox – with the “Yes” button
- 2x DatePicker – with the “No” button
- By confirming the type of controls used, they will be inserted in a pre-selected place on the edit form.
- If the required position is not determined before inserting a new schedule, the new schedule will be inserted at the end of the edit form.
1.3. 2x TextBox
- CheckBox named “From-To”
- OnClick:
try { ng_fromto_OnClick(); } catch (e) {}
- TextBox named “Schedule”
- Data type: Date
- Options: Time, Show abbreviated name of the day
- The label “Schedule from” is set by JavaScript only while “From-To” is checked.
- OnChange:
try { if (#ng_schedule#.value != '' && #ng_fromto#.checked && #ng_to#.value != '') { var from = Str2Date(control_GetValue(#ng_schedule#)); if (from > Str2Date(control_GetValue(#ng_to#))) control_SetValue(#ng_to#, from); } } catch (e) {}
- TextBox named “to”
- Data type: Date
- Options: Time, Show abbreviated name of the day
- If “From-To” is not checked, the value of the control is cleared.
- JavaScript
function ng_fromto_OnLoad()
{
try
{
if (#ng_fromto#.checked)
{
#ng_to:Table#.style.display = '';
#ng_schedule:Name#.innerText = 'Schedule from';
}
else
{
#ng_to:Table#.style.display = 'none';
#ng_schedule:Name#.innerText = 'Schedule';
control_SetValue(#ng_to#, '', '');
}
}
catch (e) {}
}
function ng_fromto_OnClick()
{
ng_fromto_OnLoad();
try
{
if (#ng_fromto#.checked)
{
if (#ng_schedule#.value != '') control_SetValue(#ng_to#, #ng_schedule#.value, #ng_schedule#.tb2.value);
}
}
catch (e) {}
}
ng_fromto_OnLoad();
1.4. 2x DatePicker
- CheckBox named “From-To”
- OnClick:
try { ng_fromto_OnClick(); } catch (e) {}
- DatePicker named “Schedule”
- Options: Time, Show abbreviated name of the day
- The label “Schedule from” is set by JavaScript only while “From-To” is checked.
- OnChange:
try { var from = Str2Date(control_GetValue(#ng_schedule#)); if (!#ng_fromto#.checked || from > Str2Date(control_GetValue(#ng_to#))) control_SetValue(#ng_to#, from); } catch (e) {}
- DatePicker named “to”
- Options: Time, Show abbreviated name of the day
- If “From-To” is not checked, the control takes the value of the “Schedule” control (a one-day event), both when the edit form is opened and whenever the “Schedule” value changes.
- Controls inserted by the current version of NET Genium behave this way; controls inserted earlier keep their original JavaScript.
- JavaScript
function ng_fromto_OnLoad()
{
try
{
if (#ng_fromto#.checked)
{
#ng_to:Table#.style.display = '';
#ng_schedule:Name#.innerText = 'Schedule from';
}
else
{
#ng_to:Table#.style.display = 'none';
#ng_schedule:Name#.innerText = 'Schedule';
control_SetValue(#ng_to#, Str2Date(control_GetValue(#ng_schedule#)));
}
}
catch (e) {}
}
function ng_fromto_OnClick()
{
ng_fromto_OnLoad();
try
{
if (#ng_fromto#.checked)
{
#ng_to:Id#_Init();
control_SetValue(#ng_to#, Str2Date(control_GetValue(#ng_schedule#)));
}
}
catch (e) {}
}
ng_fromto_OnLoad();
1.5. Edit or delete controls
- For each existing control, a pencil icon appears on the left side of the edit form to change or delete the control's settings.
- Individual controls can be moved vertically in the edit form using the Drag&Drop method. Moving consists of grabbing the control, preferably behind its name located in the left column of the edit form, and then dragging it to the desired position in the edit form.
- Controls can be moved only with the “Drag&Drop” check box located above the toolbar with controls selected. For security reasons, this check box is cleared after each login to the application, so that a control is not moved by accident.
- Deleting a control results in the irreversible deletion of the database column associated with that control in the database, and thus in the deletion of its values in all records in the database table. Some controls in system edit forms cannot be deleted because they are necessary for the basic functionality of the entire application.