| xHarbour Reference Documentation > Command Reference | 
![]()  | 
  ![]()  | 
  ![]()  | 
 
Creates a Get object as list box and displays it to the screen.
@ <nTop>, <nLeft>, <nBottom>, <nRight> ;
      GET <nVar>|<cVar> ;
  LISTBOX <aListItems> ;
 [CAPTION <cCaption>] ;
 [MESSAGE <cMessage>] ;
    [WHEN <lWhen>] ;
   [VALID <lValid>] ;
   [COLOR <cColor>] ;
   [FOCUS <bFocus>] ;
   [STATE <bState>] ;
    [SEND <msg>] ;
 [GUISEND <guimsg>] ;
[DROPDOWN] ;
[SCROLLBAR]
Color values for list boxes
| Color value | Description | 
|---|---|
| 1 | Color for unselected list box items when the list box does not have input focus | 
| 2 | Color for the selected list box item when the list box does not have input focus | 
| 3 | Color for unselected list box items when the list box has input focus | 
| 4 | Color for the selected list box item when the list box has input focus | 
| 5 | Color for the list box's border | 
| 6 | Color for the list box's caption | 
| 7 | Color for the list box's accelerator key | 
| 8 | Color for the list box's drop down button | 
The @...GET LISTBOX command creates a Get() object and assigns a HbListbox() object to the oGet:control instance variable. The HbListbox() object displays a list box in text mode and allows a user to select an item from a list of items within the READ command. The variable <aListItems> must be initialized with an array before READ is called.
The Get object created with @...GET LISTBOX is stored in the current Getlist array. The Get object communicates with the associated HbListBox object while the READ command is active. This communication ensures that focus and selection changes are properly displayed on the screen.
| See also: | @...GET, Get(), HbListbox(), HbScrollbar() | 
| Category: | Get system , Input commands | 
| Source: | rtl\listbox.prg | 
| LIB: | xhb.lib | 
| DLL: | xhbdll.dll | 
// The example creates a normal and a drop down list box.
   #include "HbLang.ch"
   #include "Inkey.ch"
   PROCEDURE Main
      LOCAL aDays[7]
      LOCAL aHours[24]
      LOCAL cDay := "", nHour := 1
      LOCAL cColor := "N/BG,W+/BG,W+/BG,W+/R,GR+/BG,N/BG,GR+/BG,N/R"
      FOR i:=1 TO 7
         aDays[i] := HB_LangMessage( HB_LANG_ITEM_BASE_DAY + i-1 )
      NEXT
      FOR i:=1 TO 24
         aHours[i] := Padl( i-1, 2, "0" ) + ":00"
      NEXT
      SET EVENTMASK TO INKEY_ALL
      SET COLOR TO ( cColor )
      CLS
      @  3, 15,  7, 25 GET cDay ;
                   LISTBOX aDays ;
                   CAPTION "Select &day " ;
                     COLOR cColor
      @ 10, 15, 20, 25 GET nHour ;
                   LISTBOX aHours ;
                   CAPTION "Select &hour" ;
                     COLOR cColor ;
                  DROPDOWN SCROLLBAR
      READ
      ? "Day :", cDay
      ? "Hour:", aHours[nHour], nHour-1
   RETURN
http://www.xHarbour.com