Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Define class programmatically
Message
From
12/11/2003 04:33:02
 
 
To
11/11/2003 22:42:09
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00848966
Message ID:
00849003
Views:
26
Hi Paul,

Try the sample code below to see if it helps you.

Regards,

Fernando
 cMonths    = "January,February,March,April,May,June,July,August,September,October,November,December"

 oComboForm = CreateObject ("frmComboTest")
 oComboForm.Show ()

 Clear Events

 Define Class frmComboTest as Form
*------ ----- ------------ -- ----

        Height     =  80
        Width      = 210
        Name       = "frmComboTest"
        Caption    = " Form containing a ComboBox"

        WindowType =   1 
        Closable   =  .T.
        ControlBox =  .T.
        MaxButton  =  .F.
        MinButton  =  .F.
        Movable    =  .T.
        ZoomBox    =  .F.
        SizeBox    =  .F.
        AutoCenter =  .T.
        ShowWindow =   0 

        Add Object cboMonths    as cPtrComboBox  with Top               =  25      , ;
                                                      Left              =  10      , ;
                                                      Width             =  80      , ;
                                                      RowSourceType     =   1      , ;
                                                      RowSource         = cMonths  , ;
                                                      ColumnCount      	=   1      , ;
                                                      ColumnWidths     	= "80"     , ;
                                                      Style            	=   2      , ;
                                                      DisplayCount     	=  12      , ;
                                                      Value             =   1

        Add Object cmdCancel    as CommandButton with Top               =  20      , ;
                                                      Left              = 130      , ;
                                                      Height            =  25      , ;
                                                      Width             =  75      , ;
                                                      FontName          =  "Arial" , ;
                                                      FontSize          =   8      , ;
                                                      Cancel            = .T.      , ;
                                                      Caption           = "\<Close"

        Procedure cmdCancel.Click
*                 --------- -----
                  ThisForm.Release
        EndProc

        Procedure cboMonths.Click
*                 --------- -----
                  MessageBox ("You selected " + This.List (This.ListIndex) )
        EndProc

        Procedure QueryUnload
*                 -----------
                  ThisForm.cmdCancel.Click
                  NoDefault
                  Return .T.
        EndProc

 EndDefine

 Define Class cPtrComboBox as ComboBox
*------ ----- ------------ -- --------

        Height            =  20
        Width             = 150
        Margin            =   0

        Enabled           =  .T.
        Visible           =  .T.
        ReadOnly          =  .F.
        Style             =   0 

        FontName          =  "Arial"
        FontSize          =   8

 EndDefine
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform