Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide to Clip-4-Win version 3.0 - <b>@ id ... listbox</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
@ ID ... LISTBOX
Use a list box control in a dialog
------------------------------------------------------------------------------

Syntax
#include "windows.ch"
#include "topclass.ch"   --or--   #define  NO_C4WCLASS
#include "commands.ch"
@ ID  <nId>  LISTBOX
     [ <clauses> ]

Arguments
See the generic @ ID ... <ControlType> command for details of
the <clauses> and/or parameters allowed.  The most common
clauses are <cCmd> and ITEMS <xInit>.  Here, the <xInit>
should be an array of strings to fill the list box.

Description
This command allows you to use a list box in a dialog.  Common
styles include LBS_NOTIFY, LBS_USETABSTOPS and WS_TABSTOP.

See the generic @ ID ... <ControlType> command for more
information.

Example
// From SOURCE\OO\DBFGEN.PRG:
CLASS DBFDialog INHERIT WDialog
     PROTECT aFlds AS ARRAY
// . . .
     PROTECT oFields AS OBJECT
// . . .
     METHOD OnInitDialog()
ENDCLASS

METHOD OnInitDialog() CLASS DBFDialog
// . . .
@ Id IDD_FLDLIST  Obj ::oFields   ListBox  Items ::aFlds
// . . .
return super:OnInitDialog()


// From SOURCE\OO\CLASSES\ODBC.PRG:
CLASS WODBC_Choose INHERIT WDialog
     PROTECT oLB    AS OBJECT // AS WListBox
     PROTECT oUID   AS OBJECT // AS WEdit
     PROTECT oPwd   AS OBJECT // AS WEdit

     EXPORT DSN     AS STRING
     EXPORT Password AS STRING
     EXPORT UserID  AS STRING

     MESSAGE Init(oParent, aDB)    METHOD InitDBDlg()

     METHOD Ok()                                          ;
            INLINE ::DSN      := ::oLB:CurItem,            ;
                   ::UserID   := ::oUID:Text,              ;
                   ::Password := ::oPwd:Text,              ;
                   super:Ok()
ENDCLASS

METHOD InitDBDlg(oParent, aDB) CLASS WODBC_Choose
local     aDSN := array(len(aDB))

AEvalOld(aDB, {|a, i| aDSN[i] := a[1]}) // pick out DSN's

super:Init(oParent, , .f., .t.)

INIT DIALOG self                                  ;
     TITLE "Choose a Data Source"                 ;
     STYLE ::WndStyle  AT 20,20  SIZE 240,165

@ ID    -1    SAY "&Data Sources:"            AT 10,10  SIZE 60,12
@ ID   101    OBJ ::oLB  LISTBOX  ITEMS aDSN  AT 10,25  SIZE 110,130

@ ID  IDOK    BUTTON Ok      TITLE "&Ok"      AT 180,7  SIZE 50,14
@ ID IDCANCEL BUTTON Cancel  TITLE "&Cancel"  AT 180,25 SIZE 50,14

// . . .

::Create()

return self


See Also: @ ID ...

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson