Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Member Class in Grid
Message
De
27/08/2003 20:22:48
James Blackburn
Qualty Design Systems, Inc.
Kuna, Idaho, États-Unis
 
 
À
27/08/2003 20:01:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00823636
Message ID:
00824029
Vues:
25
What I want is to have a grid class that uses my controls even if I have columncount = -1. It would have been nice if I could have used a memberclass for the control as well. What I did works but is not as easy to work with.

Thanks for your response.


>I must be missing just what it is you're asking for. Since you can't visually define a column class, you have to define in a .PRG.
>
>You then set the Grid's .MemberClass property to your classname in your .PRG (which automatically sets the .MemberClassLibrary to the .PRG. You can set that in the class designer for a grid, or for a form with a grid in it. When columns are added to your grid, they'll use your custom column definition, which you can either add controls in the DEFINE CLASS with ADD OBJECT, or you can use the AddObject() method to add your controls.
>
>
*
>* custcolumn.prg
>*
>DEFINE CLASS myColumn AS Column
>  ADD OBJECT MyText AS TextBox ;
>      WITH FontSize=12, ;
>           FontBold = .T., ;
>           Visible = .t.
>ENDDEFINE
>
>Once you have this, all you need to do is modify the Grid.MemberClass and Grid.memberClassLibrary properties to use your new column with it's custom controls.
>
>
>>Hi Fred,
>>
>>That is what I was asking. How do I define a column with MY control? The only way I could find was to addobject() in my colum code. I added the properties below so I can change the control in the visual designer.
>>
>>>But can't you just define a column class that uses your TextBox and then use the Grid's MemberClass properties to add your specialized column? I do believe that's the intent of the whole MemberClass animal.
>>>
>>>
>>>>Fred,
>>>>
>>>>Too bad. It would have been nice to be able to define a default control different from the base textbox we get now. I find that the text1 control that always gets added is not if my control class addes my control at runtime. For example.
>>>>
>>>>
>>>>DEFINE CLASS cColumn AS column
>>>>	HeaderClass = "cheader"
>>>>	HeaderClassLibrary = "cgridclass.prg"
>>>>	cControlClass = "cgrid_textbox"
>>>>	cControlClassLib = "cgridcontrols"
>>>>	cControlName = ""
>>>>	PROCEDURE init()
>>>>		LOCAL lcControl
>>>>		IF NOT EMPTY(this.cControlClass) AND NOT EMPTY(this.cControlClassLib)
>>>>			IF EMPTY(this.cControlName)
>>>>				this.cControlName = this.cControlClass
>>>>			ENDIF
>>>>			this.NewObject(this.cControlName,this.cControlClass,this.cControlClassLib)
>>>>			this.CurrentControl=this.cControlName
>>>>			DODEFAULT()
>>>>			FOR EACH loControl IN this.Controls
>>>>				loControl.visible = .t.
>>>>			NEXT
>>>>		ENDIF
>>>>	ENDPROC
>>>>		
>>>>ENDDEFINE
>>>>
>>>>
>>>>
>>>>>>Hi All
>>>>>>
>>>>>>I can't find a way to set the control in a column except to addobject() the control. Is there not a memberclass for the control similar to the headerclass?
>>>>>>
>>>>>>Thanks
>>>>>
>>>>>Since a Column can only have a single header, you can use the HeaderClass and HeaderClassLibrary properties.
>>>>>
>>>>>If you're looking to add different controls along with the header, you'll have to do that in the Designer for each individual column, or at runtime using AddObject, but it sounds like you already know how to do that. There is no MemberClass properties except for the HeaderClass.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform