Go Back
Virtuoso standard control libraries push button

Momentary Push Button

The Momentary Push button control allows digital inputs to be manually controlled at runtime.

Description

The Momentary Push Button control allows digital inputs to be manually controlled at runtime. Any Boolean value on the schematic can be driven by the Momentary Push Button.

To use a Push Button, drag and drop it from the Virtuoso Components control group onto the schematic, or right-click the schematic area and type “LED” and select the LED from the drop-down.

PushButtonNewVariable

The Push Button has a single IsClicked Boolean output port and a ButtonClicked event which fires when the push button is ciicked.

CreatePushButtonVariableBit

The Push Button’s properties are shown below.

PushButtonToolboxItemWithArrow

The Component ID is generated randomly when the Push Button instance is created.

The Display Name is shown beneath the Push Button at runtime as shown below.

The wizard dialog will open as shown below.

To easily see how the Push Button works, connect the Push Button to an LED as shown below. When you run the host, you will be able to turn on the LED by clicking the Push Button. The port connection snippet metadata converts the knob’s double precision output to a Boolean by converting it to false if the value is exactly 0, and converting it to true if the value is greater than zero.

The wizard dialog will open as shown below.

The XAML code emitted for the Push Button and LED for a C# WPF host are as shown below, with the data context for each binding to their respective view models.

The emitted base view model code regions are shown below. The Push Button and LED view model properties are declared.

They are then initialized in the initialization section based on their configurations:

The port connection results in the Knob value’s change notification causing the LED value to be updated after being converted to a Boolean, as shown.