Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ActiveControl in Hacker's Guide to Foxpro.
Message
From
18/10/2000 10:02:57
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
ActiveControl in Hacker's Guide to Foxpro.
Miscellaneous
Thread ID:
00430874
Message ID:
00430874
Views:
28
I just spent a while figuring out something....

In the activecontrol section there is a code sample to give you the "real" active control in a grid.
If you look up "activecontrol".
There is small problem with it and that is that if you move the columns around in the grid (moveable=.t.)
it returns the wrong object...(Returns the control in the column that used to be there)..

The old code was:
IF UPPER(ALLTRIM(oActiveC.BaseClass)) = "GRID"
  *  Name of the real ActiveControl:
  lcActiveControl = oActiveC.Columns[oActiveC.ActiveColumn].CurrentControl
  *  object reference to ActiveColumn:
  oActiveC = oActiveC.Columns[oActiveC.ActiveColumn]
  *  text string representing ActiveControl reference:
  lcJunk = "oActiveC." + lcActiveControl
  *  object reference to the real ActiveControl:
 
  oActiveC = &lcJunk
  cFeltNavn    = UPPER(oActiveC.parent.NAME)
ENDIF


The new code I figured out is:
IF UPPER(oActiveC.BASECLASS) = "GRID"
	FOR i = 1 TO oActiveC.COLUMNCOUNT
		IF oActiveC.COLUMNS(i).COLUMNORDER = oActiveC.ACTIVECOLUMN
			oActiveC = oActiveC.COLUMNS(i)
			IF TYPE('oActiveC.combo1') == 'O'
				cFeltNavn    = UPPER(oActiveC.NAME)
				oActiveC = oActiveC.combo1
			ENDIF
			EXIT
		ENDIF
	NEXT
ENDIF
Everyone else probably noticed that but in case not...
Next
Reply
Map
View

Click here to load this message in the networking platform