F.A.Q.

How to create a button label that changes its text accordingly to the button state

Written by Mark Olding | Sep 21, 2023 8:21:19 AM

What to know

With JMobile you can create a Button with a label that changes its text according to the button state.
It can be obtained by creating a custom widget, that will be composed by a Button and a Message Text widget.

What to do

1. Drag and drop in page, from the Widget Gallery, the Button and the Message Text widgets placing them in the desired position.

 

 

 

 

 

 

 

 

 

 

 

 

2. Double click on the text Message Text widget and configure the text to be displayed for each of the Button states.
In our example the message will display START" when the button is in released state and "STOP" when the button is in pressed state.

 

 

 

 

 

 

 

 

Note: It it not necessary to define the Message texts before to create the custom widget, this property can be edited at anytime as explained in the note placed at the end of this FAQ

3. Attach the Message Text "Value" property to the Button Value property.
As you can see from the image below the Button properties are reachable from the Widget source selection available into the Attach to Tag dialog.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

4. Select both the widgets

5. Right click on selection and select "Group"

Now this group can be copied and pasted to be used many times in the project.

 

Applies to

JMobile Studio