Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ActiveControl in Hacker's Guide to Foxpro.
Message
De
18/10/2000 10:02:57
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
ActiveControl in Hacker's Guide to Foxpro.
Divers
Thread ID:
00430874
Message ID:
00430874
Vues:
30
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...
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform