Button: Display text on button release

91 views
Skip to first unread message

Scott Ferguson

unread,
Sep 17, 2012, 1:41:07 PM9/17/12
to
The button component allows the app to do something when the button is touched.

This exercise places some text in the Title bar when a button is touched and released.

Create a project titled: lrn_button_display_text 

Screen Designer:

Drag a button component to the layout area.
Under Properties change the Text to Display message.















Click on the Title bar.
Under Properties change the Title to <message will display here>















Blocks Editor:
Drag out a Button1.Click event block from My Blocks, Button1.
 - this will cause the blocks it contains to execute when the button is released.






Drag out a Screen1.Title block from My Blocks, Screen1 and drop it inside Button1.Click






















Drag out a text block from Built-In, Text and snap it's tab into the Screen1.Title socket.
Click on the word 'text' in the text block and change it to The button was released.
 - when the button is released, the new text will appear on the Title bar.






Now test your project with the emulator or your connected device.
The output should look like this and if so, congratulations!:







END.

Challenge:

The button text can be changed with the set-Button1.Text-to block. Can you get the text of the button to display the message rather than the screen Title bar?

lrn_button_display_text.zip
Reply all
Reply to author
Forward
0 new messages