4D v16

4D Widget components

Home

 
4D v16
4D Widget components

4D Widget components  


 

 

4D widgets are functionalities provided as components that can be accessed from the Form editor and/or the preconfigured object library. These widgets are compound objects with predefined characteristics. They provide access to standard functions and are very simple to implement.

Three widgets are available:

  • SearchPicker: search area with standard appearance.
  • DatePicker: date selector.
  • TimePicker: time selector.

These widgets can be used with or without programming. You can simply integrate them into your forms and use their default properties. If you want to be able to control and configure them in a more customized manner, you can make use of specific project methods, called "Component methods," which are listed by component on the Methods page of the Explorer:

This documentation covers each widget and describes the syntax of the component methods associated with it.

 There are two ways to insert a widget area in a form:

  • Using the object library
  • Using a subform

To insert a widget using the object library:

  1. Select the Object Library command from the Design menu.
    The Object Library window appears.
  2. Select Widgets in the Category menu.
    All the available widgets are listed:
  3. Insert the desired widget into your form by dragging and dropping it.
    You can then configure it via the properties of the inserted object or via its object method.

To create a widget via a subform type object:

  1. In the Form editor, add a subform object.
    This point is described in the 4D Design Reference manual.
  2. In the Property List, click on the "Detail Form" menu to scroll through the list of forms that can be used. This list includes the widgets.
  3. Select the widget to be inserted.
    You can then configure it via the object properties or the object method of the subform.

 Widgets are based on 4D subforms and are therefore subject to the same operating principles. You should pay particular attention to their initialization.

For optimization purposes, subform objects are instantiated by 4D only when the subform is displayed. This means that method calls via EXECUTE METHOD IN SUBFORM or access to dynamic objects in subforms are not possible until the subform is displayed on the current page.

When you place widgets on form pages other than page 1, it is not possible to call an initialization method (such as TimePicker SET STEP) in the On Load form event, because at the time of its execution the widget will not be instantiated.

To handle this case, widget areas return a specific event with a value of -1 to indicate that they are loaded and ready for use. This event must be tested at the object method level of the widget itself, in the same way as the On Data ChangeOn Load etc. Therefore when the widget is located on a form page other than page 1, it's necessary to write:

 If(Form event=-1) // the widget is instantiated and can be initialized
    TimePicker SET STEP("myTimePicker";? 00:10:00?) // example
 End if

rather than:

 If(Form event=On Load// only works if the widget is on page 1
    TimePicker SET STEP("myTimePicker";? 00:10:00?)
 End if

 
PROPERTIES 

Product: 4D
Theme: 4D Widget components

 
HISTORY 

 
ARTICLE USAGE

4D Widgets ( 4D v16)