Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Get ActiveRow,ActiveColumn,RelativeRow,RelativeColumn
Message
From
19/06/2003 07:42:26
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
19/06/2003 06:51:04
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00801629
Message ID:
00801665
Views:
17
Hi Gregory,
this looks for a general method.
But I see one little problem in it. This will normaly happen in some strange situations so it is not easy to trace. (I run to often in that)

You check for TYPE('_ActiveControl') == T_OBJECT ). There is a situation where _ActiveControl shows type 'O' and
is not an object. You need to check for the NULL value like:
IF !TYPE('thisform.ActiveControl') == T_Object OR  ISNULL(thisform.ActiveControl')
  RETURN NULL
ELSE
 _ActiveControl = THISFORM.ACTIVECONTROL
ENDIF
....
HTH
Agnes

BTW
IF( !(TYPE('_ActiveControl') == T_OBJECT ) )
 ASSERT FALSE
ENDIF
is the same as
ASSERT TYPE('_ActiveControl') == T_OBJECT 
::)


>Hi Agnes,
>
>For what it is worth I include a form method: GetActiveControl()
>
>When a grid has the focus, it returns the actual control within the grid unless called with a parameter TRUE
>
>lparameters	DoNotGoDownIfGrid
>
>local	_ActiveControl, _ActiveColumn, i, x
>
>if( type('thisform.ActiveControl') == T_UNDEFINED )
>	return Null
>else
>	_ActiveControl = thisform.ActiveControl
>endif
>
>if( !(type('_ActiveControl') == T_OBJECT ) )
>	assert FALSE
>endif
>
>if( !DoNotGoDownIfGrid and (Proper(_ActiveControl.BaseClass) == 'Grid') )
>	_ActiveColumn = _ActiveControl.ActiveColumn
>	
>	if( !empty(_ActiveColumn) )
>		for i = 1 to _ActiveControl.ColumnCount
>				x = _ActiveControl.Columns[i]
>			if( x.ColumnOrder == _ActiveColumn )
>				exit
>			endif
>		endfor
>		for i = 1 to x.ControlCount
>			if ( x.Controls[i].Name == x.CurrentControl )
>				_ActiveControl	= x.Controls[i]
>				exit
>			endif
>		endfor
>	endif
>endif
>
>return _ActiveControl
>
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform