Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GRID - DynamicCurrentControl - Is there a limit?
Message
From
02/10/2001 03:36:22
 
 
To
01/10/2001 16:13:07
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00562699
Message ID:
00562888
Views:
22
This message has been marked as the solution to the initial question of the thread.
Hi!

Frst of all, I'm wondered why you think that this expression is too long. Dynamic* expression could be ~8000 chars long (VFP limit for code line), as far as I know. You cannot put string longer than 255 chars into the property in design time using properties list, however, you can assign expression string to the property in run-time. Ok, I see from your code that string, indeed, could reach the maximum limit evenn for real VFP expression...

Second, as Nadya pointed, you build controls by their names in the table. I see following:
lcDynamic = lcDynamic + "IIF(nome_object = '" + lcClasse + "','" + lcClasse + "',"

However, you use the same name - to compare AND to use as a control name. In your case you can change the ENTIRE DynamicCurrentControl expression to following:

iif(empty(nome_object),'barra',alltrim(nome_object))

Why check for object name in IIF when you use that name immediately? ;) No nee to build expression in a loop, just use a name as a value returned by DynamicCurrentControl expression. It is short and quick.


Finally, some notes about code:
>		This.&lcClasse..Visible = .T.
>		This.&lcClasse..AddObject('oCampo', lcSubClasse)
>		This.&lcClasse..oCampo.Visible = .T.
>               .....
Following approach will work more quickly:
		with Evaluate("This." + lcClasse)
			.Visible = .T.
			.AddObject('oCampo', lcSubClasse)
			.oCampo.Visible = .T.
			* .... Other things with lcClasse
		endwith
HTH.

>I write this code in the Init method of Column:
>
>****************************************************
>This.AddProperty('nOldWidth', This.Width)
>SELE vMonta_fvis
>lcDynamic = ''
>This.AddObject('barra', 'Grupo') && This is a container that no have a object.
>SCAN
>	lcClasse = ALLTRIM(vMonta_fvis.nome_object)
>	lcSubClasse = ALLTRIM(vMonta_fvis.nome_classe) + '_'
>	*
>	IF vMonta_fvis.edit_campo
>		lcDynamic = lcDynamic + "IIF(nome_object = '" + lcClasse + "','" + lcClasse + "',"
>		*
>		This.AddObject(lcClasse, 'Grupo') && This is a container that will have a objects.
>		This.&lcClasse..Visible = .T.
>		This.&lcClasse..AddObject('oCampo', lcSubClasse)
>		This.&lcClasse..oCampo.Visible = .T.
>		IF ALLTRIM(vMonta_fvis.nome_classe) = 'CHECKBOX' .OR. vMonta_fvis.tipo_campo $ 'DT'
>			This.&lcClasse..oCampo.cControlsource = ALLTRIM(vMonta_fvis.nome_bd) + ;
>			    	                                '.' + ALLTRIM(vMonta_fvis.nome_campo)
>		ELSE
>			This.&lcClasse..oCampo.Controlsource = ALLTRIM(vMonta_fvis.nome_bd) + ;
>		    	                                    '.' + ALLTRIM(vMonta_fvis.nome_campo)
>		ENDIF
>		IF !EMPTY(vMonta_fvis.form_campo)
>			This.&lcClasse..oCampo.InputMask = ALLTRIM(vMonta_fvis.form_campo)
>		ENDIF	
>		IF ALLTRIM(vMonta_fvis.nome_classe) = 'COMBOBOX'
>			This.&lcClasse..oCampo.RowSource = ALLTRIM(vMonta_fvis.text_origem)
>		ENDIF
>	ENDIF
>ENDSCAN
>lcDynamic = lcDynamic + "'barra'" + REPLICATE(")", OCCURS("IIF(", lcDynamic))
>This.DynamicCurrentControl = lcDynamic
>GO TOP
>***********************************
>In This case the expression for the DynamicCurrentControl is to long.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform