ListBox

 

Here we will learn how to use a ListBox that is provided by views

 

A list box is used to display items in a list. The user may select any item from the list. A ListBox can have the following properties:

Name, Text, Height, Width, ForeColor, BackColor, Font, halign and valign. The full description on these properties can be found here.

 

 

Example of ListBox

Below we give an example where a ListBox is used to display the vending machine items. For a change we start with a code instead of the image.

 

Example 2.6.1: Source

@"<Form Text= 'Vending machine'>
<Vertical>
<Label Text = 'Vending Machine'/>
<Horizontal>
  <ListBox Name = list BackColor = Blue ForeColor = Yellow Font = Bold12 Height = 3.0in Width = 2.0in/>
   <Vertical valign = Middle>
  <Horizontal>
     <Label Text = 'Balance'/>
      <TextBox Name = balance Text = '0.0' Width = 1in/>
  </Horizontal>
  <Horizontal>
     <Button Name = Change Text = 'get Change'/>
    <Button Name = Coin Text = 'Insert Coin' Width = 1in/>
  </Horizontal>
</Vertical>
</Horizontal>
<Button Name = Vend halign = Center/>
</Vertical>
</Form>";

The code above represent the following diagram, i.e. A simple vending machine system.

         

 

<<PREVIOUS  |  NEXT>>