Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Programmaticaly addrow to grid and deleterow from grid
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00714250
Message ID:
00715405
Views:
25
Soykan,

Check FAQ section here and UT Magazine. In FAQ section search for Mike Helland's "How to add controls to the grid programmatically" and in UT Magazines search for Vlad Grynchyshyn Grid's serias (there are 3 articles in 3 magazines). Study the code and try to implement it.

Here is an example of one of my form's method (AdjustGrid). I invoke this method in Form's Init:
********************************************************************
*  Description.......: AdjustGrid - replaces grid's headers with headers based on class
*  Calling Samples...: 
*  Parameter List....: 
*  Created by........: Nadya Nosonovsky 06/24/2002 09:22:36 AM 
*  Modified by.......: Nadya Nosonovsky 07/23/2002 05:34:58 PM
********************************************************************
lparameter toGridObject
if vartype(m.toGridObject)<>"O"
   toGridObject = thisform.pgfEditResult.page2.grdBldMstr
endif   
for each oColumn in m.toGridObject.columns
	for each loObject in oColumn.controls
		if lower(loObject.class)="header"
			lcCaption=loObject.caption
			oColumn.removeobject("Header1")
			oColumn.newobject("Header1",'myHeader','myHeader.prg',"",m.lcCaption)
			with oColumn.Header1
			    .name="Header1"
			    .caption=m.lcCaption
			    .fontbold=.t.
			    .alignment=2
			    .lNoActiveHighlight = .t.
			    .statusbartext = space(5)+oColumn.comment
				.tooltiptext = oColumn.comment
				.cTagName = oColumn.tag
			endwith
		endif
	next
next
As you see in this example, I change Header class in run-time for each column. You have to adjust this code a little bit to do the same for textboxes.



>Thanks Ed,
>i know Cetin's class yeah its commercial . now another way is your suggest i'll create textbox class then i use it but step by step changing the column controls for textbox on the grid maybe boring ... how can i add this textbox class programmaticaly for each column with for...endfor or for..next loop to the grid . Is it true do this at run time at each activate or not ?
>
>TIA
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform