Scenario 2 of 7 / 5 illustrated steps

Make the Button Work

Visual design and your own Rust logic work together.

Connect a Button to a Rust event handler, change the design, and see the result in the running application.

In this scenario 5 steps · jump to a capture

Select any screenshot to enlarge it. Use ← / → to move between captures, Esc to close, and 100% to inspect original detail.

01

Select the button and open its handler

The selected Welcome Button appears in the designer and Inspector. The annotation shows Go to handler and notes that double-clicking the Button also opens its handler.

Why it matters The visual control provides a direct route to its behavior.

Welcome button selected with Go to handler highlighted in the Inspector.
02.01 · Select the button and open its handler
02

Write the message in Rust

The handler in handlers.rs assigns “Hello from ordinary Rust!” to the form’s welcome_text field. This is the custom logic that will run when the Button is clicked.

Why it matters Application behavior is expressed in ordinary Rust code.

Rust button handler assigning Hello from ordinary Rust to welcome_text.
02.02 · Write the message in Rust
03

Change the design and keep the logic

The Button caption becomes “Say Hello”. The annotated sequence saves the project with Ctrl+S, then uses Run to compile and launch it. The following captures show the custom handler still working.

Why it matters You can revise the interface while retaining your event logic.

Say Hello caption in the designer with Save and Run instructions.
02.03 · Change the design and keep the logic
04

Before the click: the app is running

The compiled application is open with its “Say Hello” Button. The handler’s greeting is not yet displayed; the annotation points to the Button to press.

Why it matters This is the starting state for a visible behavior check.

Running application before the button click, without the greeting.
02.04 · Before the click: the app is running
05

After the click: the label changes

The same application now displays “Hello from ordinary Rust!” above the Button. The before/after pair shows the result of the click handler written earlier.

Why it matters The design, event connection, and custom code produce an observable result.

Running application after the click, displaying Hello from ordinary Rust!
02.05 · After the click: the label changes

← Back to Home