Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Command button programatically firing
Message
From
01/04/2002 05:12:09
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00636847
Message ID:
00639358
Views:
21
Hi Timothy,

I use to create ALL my forms and other classes programatically (in PRGs), although this is not common or even a good practice, some may say. Anyway below is some fragments I use to create forms, and the related classes.

This is use to activate the form:
 oUpdateTaskTable = CreateObj ("frmUpdateTaskTable")

 oUpdateTaskTable.Show ()
This is the form definition:
 Define Class frmUpdateTaskTable as cPtrForm
*------ ----- ------------------ -- --------

        Height     = 420
        Width      = 775
        Name       = "frmUpdateTaskTable"
        Icon       =  gDeskTopIco
        Caption    = " This Is The Form Caption"

        Add Object cmdCancel    as cPtrButton    with Top               = 390      , ;
                                                      Left              = 695      , ;
                                                      Cancel            = .T.      , ;
                                                      Caption           = "\<Close"
        Procedure cmdCancel.Click
*                 --------- -----
                  ThisForm.Release
        EndProc
 
        Procedure QueryUnload
*                 -----------
                  This.cmdCancel.Click

                  NoDefault

                  Return .T.
        EndProc

 EndDefine
And these are the classes used to add the controls to the form they are mantained in "library" classes written in separate PRGs):
 Define Class cPtrForm as Form
*------ ----- -------- -- ----

        Closable          =  .T.
        ControlBox        =  .T.
        MaxButton         =  .F.
        MinButton         =  .F.
        Movable           =  .T.
        ZoomBox           =  .F.
        SizeBox           =  .F.
        HelpContextID     =   0 
        WhatsThisHelpID   =  -1
        WhatsThisHelp     =  .F.
        WhatsThisButton   =  .F.
        AutoCenter        =  .T.
        ShowWindow        =   0 
        BorderStyle       =   2 
        Enabled           =  .T.
        AlWaysOnTop       =  .F.
        WindowType        =   1 
        ShowTips          =  .T.

        Caption           =  "" 
        Icon              =  "" 
        Picture           =  "" 

        ScaleMode         =   3 
        Height            =   1 
        MaxHeight         =  -1 
        MinHeight         =  -1 
        Width             =   1 
        MaxWidth          =  -1 
        MinWidth          =  -1 

        ColorSource       =   4

        FontName          =  "Arial" 
        FontSize          =   8
        FontBold          =  .F.
        FontItalic        =  .F.
        FontStrikeThru    =  .F.
        FontUnderline     =  .F.

 EndDefine


 Define Class cPtrButton as CommandButton
*------ ----- ---------- -- -------------

        Top               =   0
        Left              =   0
        Height            =  25
        Width             =  75

        Cancel            =  .F.
        Default           =  .F.
        Enabled           =  .T.
        Visible           =  .T.
        Style             =   0 
        TabStop           =  .T.

        Caption           =  "" 
        ToolTipText       =  "" 

        HelpContextID     =   0 
        WhatsThisHelpID   =  -1

        MousePointer      =   0
        MouseIcon         =  ""

        FontName          =  "Arial"
        FontSize          =   8
        FontBold          =  .F.
        FontItalic        =  .F.
        FontStrikeThru    =  .F.
        FontUnderline     =  .F.

 EndDefine
Perhaps it can help you (I hope).

Fernando
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform