Adding a "Button" Object to a Screen

Navigation:  How to Work with Screens > Adding Menu/Selection Objects to a Screen >

Adding a "Button" Object to a Screen

Previous pageReturn to chapter overviewNext page

 

Object Purpose

 

This object is used to deploy an action. It can be displayed with text or images.

 

Add a button to a screen by dragging a "Button" object from the top section of the "Control" tab OR  the "Style Preview Section" onto the screen.

 

Step-by-step

 

1. Drag the object onto the screen:

 

If dragged from the "Control" tab, the object will assume the default style.

 

If dragged from the "Style Preview Section", it will assume that particular style.

 

2. Now, double-click the selected object on the screen OR  the tree view to open the "Properties" window.

 

 

The "General" tab is open by default.

 

3. In the "Button Info" section, add text or an image to the "Button" object which is displayed on the device's screen.

 

To add text:

a. In the "Text" box, enter the required text or click to select a variable with that value. See Variable Definition.

 

b. Continue to step 5.

 

To add an image:

a. In the "Image" box, click to open a window with tabs that contain image resources ("Theme", "Designer Resources", "Project Resources", My Pictures" and a tab representing the folder you previously used as a source for an image import. In the case of the image below, it is the "C:\...\Pictures\" tab).

 

 

This window allows you to control the displayed images:

 

Click and select the most appropriate view ("Large Icons", "Medium Icons" and "Small Icons").

 

Use to filter the image display according to the defined resolution.

 

Right-clicking an existing image resource, opens a menu with several options. The available options vary according to the resource's location (the tab that includes the selected image).

Below are all the possible options:

 

New Resource

Opens an OS browse window. Browse for an image, select it and import it into the tab that is currently open.

Edit Resource

Opens your default image editor. Edit the selected image.

Transform

Allows you to rotate (90o, 180o or 270o) or flip (horizontally or vertically) the selected image file.

Duplicate Resource

Duplicates the selected image. The duplicate has the same name as the original resource plus an incremented number.

Rename Resource

Sets the image's name into "edit" mode. Enter the new name and click <Enter> in your PC keyboard.

Delete Resource

Deletes the selected image. Click in the resulting delete confirmation window.

 

b. Open the tab that contains the image you want to use.

 

c. Select the image.

 

To avoid image display issues, make sure that the dimension of the selected image resource and the target area of the Button object are the same.

 

 

d. Click to save your image choice and return to the "General" tab.

 

As a further option, you can import images into your project (the image resource will be displayed in the "Project Resources" tab and the "Resources" module):

 

a.click (located on the lower left) to open an OS browse window.

 

b. Select the image you want to import and click .

 

No matter which tab you had open when you clicked , the imported image is placed in the "Project Resources" tab.

 

c. If you want to add the imported image to the button, select it (in the "Project Resources" tab)and click to apply.

 

4. There is an advanced option regarding the image element that allows you to rotate or flip the selected image:

If required, right-click the "Image"option to access the "Advanced Image Settings" option and follow the steps described in The Display of an Object's Image Element.

 

5. This option only becomes active after you have selected an image. Define the desired position of the image inside the "Button" object (either "Top", "Bottom", "Left" or "Right").

 

6. If required, select a shortcut key in the keyboard of the device to have the same function as the "button" object. Select one from the drop-down list in the "Shortcut" box.

 

7. At this point, a target location can be assigned to the default event "On Click" attached to the object. Select a target location from the drop- down OR list. The selected target location is automatically displayed in the "Actions" tab. See Detail of a window below.

 

Detail of a window

 

This window is an alternative to the drop-down list of destinations. Select a destination screen or routine within the same program as this object in the left table and specify the target even more by selecting from the table to the right. The available options are a consequence of your choice in the left table.

If you want to add more processes, select the <Action> option.

Finish this operation by clicking .

 

The function of this object is, usually, to send the device operator to a particular screen after an "On Click" event. That means that a "Go to" process is necessary to enable an action (to deploy to a specific location such as "Exit", "Next Screen", etc.) triggered by that event. If the target location for the "On Click" event is specified here, it will not be necessary to add a "Go to" process in the "Actions" tab.

 

8. If required (when the screen also contains "Input Objects"), check the "Only if all inputs are valid" box. That means that the "Button" will only become active if every "input object", in that screen, is considered valid.

 

9. Go to the "Layout" tab.

 

 

10. Define the object's style by selecting an option from the drop-down list or by clicking . See Editing and Creating Styles and Editing and Creating the "Button" Style.

 

11. Position the text, within the object, with the alignment buttons.

 

12. Maintain the given values or specify the object's position/size, within a screen, by providing the "X" and "Y" coordinates as well as "Width" and "Height".

 

Detail of Position/Size values

 

 

 

13. Attribute a name to the object. This name is displayed in the tree view.

 

14. Consider whether or not to check the following options:

"Enable"

Activates the object's input feature.

"Tab Stop"

Must be checked to enable a "Change Tab order". This provides the possibility to change the order (between data input objects) in which the information is keyed in by the device operator.

"Visible"

Controls the object's visibility in the device's screen.

"Auto Refresh"

Enables an automatic update of the visible information, every time the value of the variables used is modified.

 

15. If the target location for the "Go to" process has already been defined, end the addition of a "Button" operation by clicking to apply all your chosen options.

If the "Go to" option in the "General" tab was left unfilled (step 6), continue to step 15.

 

 

Use the right click in MCL-Designer's input boxes to access certain features regarding the input box's option as well as general actions such as "Copy"; "Paste"; "Search".

Ex: If you right-click the "Text Data" input box (included in a "Display Text" properties window), you are provided with the "Paste", "Search..." and "Variable Select" options.

If you right-click any other input box, it will provide other possibilities.

 

 

 

16. Click the "Actions" tab.

 

Keep in mind, that there is always a default event (ex: "On Change"; "On Timer"; "On Hotkey"; etc.) attached to the object (in this case, an "On Click" event). If you want the event to trigger an action, you must add processes to it (ex: "Go To"; "Check File"; "Set Focus"; etc.).

 

By default, the "Button" object already includes a "Go to" process (see Working with the Go to Process)) attached to the "On Click" event.

 

 

 

17. To edit the "On Click" event, double-click the event row OR  right-click the event row and select "Edit..." in the resulting menu. Either of these choices opens an "Edit Event" window.

 

 

18. Select from the drop-down (B) or (C) list:

 

A

This event, performed by the device operator, is the "trigger" that enables an action to advance the application. It cannot be modified.

Default event: "On Click" - Is triggered when the device operator clicks the "button" object.

B

Provides targets for a "Go To" action (see Working with the Branch Processes Group). After the device operator has fulfilled the "On Change" event, the workflow will proceed to the selected destination. If you want to add processes other than a "Go to", select the <Action> option.

C

Provides quick links for a "Go To" action ("Next Screen"; "Exit"; etc.) to be executed when the event is fulfilled.

See Detail of a window below.

 

Detail of a window

 

This window is an alternative to the drop-down list of destinations. Select a destination screen or routine within the same program as this object in the left table and specify the target even more by selecting from the table to the right. The available options are a consequence of your choice in the left table.

If you want to add more processes, select the <Action> option.

Finish this operation by clicking .

 

19. If required, add processes to the event. See Adding and Editing Processes.

 

This object has predefined local variables (only available in event context). See "Button" predefined local variables.

 

 

 

Before concluding the addition operation, check the following:

 

Remember that the "Enable" option (located in the "Layout" tab) must be checked so that the added actions/processes run.

 

 

If required, use the icons located on the upper right corner of the "properties" window:

 

Click this icon to open a "Localization" window where you can edit the text element within that object or add translations to it. See Localization.

 

Click this icon to attach any relevant notes to this object. Enter your text in the resulting window. This information is displayed in the "Developer report". See Report.

 

 

 

20. Click in the "Actions" tab to apply the choices made.

 

The "Button" object has been successfully added to the screen.

 

 

 

To activate an instant "Edit Text" mode, select the "Button" object and click the <Space> key. To set the object back to "Read" mode, click outside the object 's area OR  click <Enter> in your PC keyboard.

 

 

 

If any subsequent edition of the object's properties is required, double-click the "Button" OR  select " 'Button' Properties" (in its right-click menu) to open the properties window.

 

 

 

If you want to view this object applied within an application, see Sample Applications.

 

 

"Button" Predefined Local Variables

 

This object has predefined local variables (only available in event context).

 

Event

On Click

Variable Name

L_Control_Name

Variable ID

&0a

Description

Stores the object's name (*)

 

* Defined in the objects properties window "Layout" tab.