Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SETALL
Message
De
28/11/2000 12:09:42
 
 
À
28/11/2000 02:21:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Re: SETALL
Divers
Thread ID:
00446038
Message ID:
00446235
Vues:
10
>Sorry, I am not familiar with SubClass.
>
>Can you show me a sample code in grid init method?
>
>Thank u.

Sure:
USE yourtable
RELEASE oForm                   && Create a PUBLIC to hold the form reference
                                && so you can manipulate the oForm object from
PUBLIC oForm                    && the command window and/or activate DEBUG
oForm = CREATEOBJECT("myForm")
oForm.Show()

DEFINE CLASS myForm AS Form
Height = 450
*
* Custom grid on top with custom textbox
*
ADD OBJECT grdCustom AS myGrid WITH ;
  Left=10, Top=10
*
* Standard grid for comparison
*
ADD OBJECT grdStandard AS Grid WITH ;
  Left=10, Top=250
ENDDEFINE

DEFINE CLASS myGrid AS Grid
FUNCTION Init
LOCAL oCol
FOR EACH oCol IN this.Columns
  oCol.RemoveObject("Text1")            && remove the standard textbox
  oCol.AddObject("Text1","myText")      && add the custom textbox
  oCol.Text1.Visible = .t.              && make it visible
ENDFOR
ENDFUNC
ENDDEFINE

DEFINE CLASS myText AS TextBox
FUNCTION Click
MessageBox("Clicked "+this.Parent.Name)
ENDFUNC
ENDDEFINE
The grid on the top is the one with the customized textbox with Click method code. The grid on the bottom is a standard grid with the standard textbox. I'd suggest looking at the created oForm object in the debugger and the two grid objects and what's in them with the debugger.

As Ko also pointed out, you can customize your grid in the form designer if you know what table and how many columns you want to see at design time.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform