Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Column ControlSource && DynamicBackColor Assign
Message
De
13/02/2002 09:41:54
 
 
À
13/02/2002 09:26:18
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00619330
Message ID:
00619435
Vues:
21
>Greg,
>I didn't mean set columncount to -1. It was just a sample procedure from one of my existing classes :) Naturally I don't expect your controlsources to match fields of a table in the same manner.
>Here you say 'by the time init fired' causing me highly suspect this grid could be modified at designtime (builder). ie:
>-I don't know what the recordsource would be
>-But just before saving my form I know columncount is set, how it 'would' look like
>
>So I take 2 possible routes :
>1) While designer open I select the grid, aselobj() and replace the grid with my own version. scx now would have my version where most or all of init code is now not needed (columns, headers, controls are now subclassed ones).
>
>2) Before saving the form I would add a temporary dummy button with code :
>thisform.myGrid.SaveAsClass(...)
>Save the form and run, wait 2-3 secs of upload time once :), click the button to create the class. Then I would dismiss the grid on form and put saved class instance (placing just a comment in init would be sufficient to override previous init code).
>
>Cetin

Cetin,

I have a couple of grids done with the builder, not many.

Most of the grids are done via program (I hate the builder)
I just drop a the grid on the form and set its RecordSource. That's all

here's a sample from a grid.init() of a form
local obj, i, cs

for i = this.ColumnCount to 1 step -1

	obj = this.Columns[i]
	
	cs = obj.ControlSource
	cs = lower(substr(cs, atc('.', cs)+1))
	
	do case
	case inlist(cs, 'r_t_id')
		obj.Header1.Caption = 'Date Done'
		obj.Header1.Comment = cs
		
	case inlist(cs, 'r_t_th_id')
		=this.RemoveObject(obj.name)
		
	
	case inlist(cs, 'r_s_id')
		obj.Header1.Caption = 'Status'
		obj.Header1.Comment = cs
	
	case inlist(cs, 'r_s_desc')
		obj.Header1.Caption = 'Status'
		obj.ControlSource = 'Status.s_desc'
	
	
	case inlist(cs, 'r_tel')
		obj.ReadOnly = FALSE
	

	endcase
endfor
obj= Null


if( !DoDefault() )   && CLass Code
	return FALSE
endif

for i = this.ColumnCount to 1 step -1

	obj = this.Columns[i]
	
	cs = obj.ControlSource
	cs = lower(substr(cs, atc('.', cs)+1))
	
	do case
	case inlist(cs, 'r_tel')
		&&
	otherwise
		obj.DynamicBackColor = 'iif(Rappel.r_DaysTooLate < 0, rgb(192,192,192), rgb(255,128,192))'
	endcase
endfor
99 % of my grids work like that. It wasn't until a week or two that I started subclassing the Columns
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform