Skip to content

2. Component method

Gary Criblez edited this page Feb 6, 2020 · 2 revisions

AJUI_FloatingLabel_main

This method allows to generate a floating label based on properties of a variable object passed as a parameter. The method will also respond to four types of 4D events to manage the display of the label. We will come back in detail to these different elements in the following sub-chapters.

Properties

The object to be passed as a parameter can have five properties.

  • target (string) : Corresponds to the name of the target form object. By default, the floating label will use the current object if it is associated to a form object method.

  • activColor (string) : Color used when the label is active. By default, the floating label will be the color of the form object FLabel_obj.

  • inactivColor (string) : Color used when the label is inactive. By default, the floating label will take the color 0x00AAAAAAAA (grey).

  • placeholder (string) : Text displayed when the label is active. By default, the floating label will take the placeholder associated with the target (to be defined in the list of properties of the form object).

  • offset (longint) : Space between the target and the floating label. The offset represent the distance between the top of the target object and the bottom of the Floating label. By default, the offset is zero.

  • Position (string) : Position of the label. Must be "top" or "left".

  • formEvent (longint) : To simulate a 4D event. You must give one of the 4D constant listed below.

  • formPath (string) : This property is usefull if you have assigned an expression to your form variable via the dot notation and the "Form" variable. You can give an path like "entity.firstName" or "myValue". It will look inside the "Form" variable to find the value.

  • showOnEmptyField (boolean) : Display the label even if the content of the target is an empty field.

FLabel_obj

The use of the component requires the creation of a variable form object typed text, to be named: FLabel_obj. It will be used as a basis for the creation of floating labels by duplication. The textual content and color will be defined according to the properties passed as a parameter of the component method. You can change the style and font directly on the FLabel_obj form object.

Events

The AJUI_FloatingLabel_main method reacts and makes the floating label evolve according to four types of event :

  • On Load : prepares the floating label.
  • On Getting Focus : associates the active color.
  • On Losing Focus : associates the inactive color.
  • On after Edit : associates the active color only if the field is not empty.

It is important to activate these events on the different fields that will use the method.

Clone this wiki locally