Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Annoying grid column behavior
Message
De
16/06/2004 18:26:11
Gary Foster
Pointsource Consulting LLC
Chanhassen, Minnesota, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Annoying grid column behavior
Divers
Thread ID:
00914482
Message ID:
00914482
Vues:
57
Hi,

I have a textbox class I use in the column of a display only grid to display a value based on the key value in the cursor field. Works like a champ EXCEPT for one annoying effect. If one clicks on that column, the column displays only the first character of the looked up description. IOW, everything looks great, the grid refreshes fine when the underlying data changes, etc., but if you should click on the column, all that columns displayed data vanishes except the first character. Does this ring any bells? I adapted some code Fabio Lunardon put up here for a similar purpose. The textbox definition is below.

Gary


DEFINE CLASS GridLookupTextbox AS ctextbox

*-- Column.sparse = .F.
*-- Column.bound = .F.

ControlSource = "m.this._Controlsource"
HIDDEN ControlSource
NullDisplay = "****************"
MyControlSource = "NULL"
_ControlSource = ''
BorderStyle = 0
DIMENSION aValues[1,2]
Width = 100

HIDDEN PROCEDURE _ControlSource_Access
*-- this.aValues is loaded when this is made the current control.
LOCAL nKeyValue
LOCAL cDescription
LOCAL nRow

cDescription = ''
nKeyValue = EVALUATE(m.this.MyControlSource)

IF ISNULL(nKeyValue) OR EMPTY(nKeyValue) OR ;
INT(VAL(TRANSFORM (nKeyValue))) = 0
cDescription = ''
ELSE
*-- If this control has an array with values...
IF TYPE('this.aValues[1]') = 'C'
*-- Scan the array associated with this control
*-- looking for the key value in column 2.
nRow = ASCAN(THIS.aValues, nKeyValue, 1, ALEN(THIS.aValues,1),2,8)
IF nRow > 0
cDescription = ALLTRIM(THIS.aValues[nRow,1])
ENDIF
ENDIF
ENDIF

*-- Return the description value
RETURN cDescription

ENDPROC

HIDDEN PROCEDURE _ControlSource_Assign
LPARAMETERS dValue
IF m.this.MyControlSource="M." && a variable or properties
STORE (m.dValue) TO (m.this.MyControlSource)
ELSE
REPLACE (m.this.MyControlSource) WITH (m.dValue)
ENDIF
ENDPROC

HIDDEN PROCEDURE MyControlSource_Assign
LPARAMETERS sControlSource
IF TYPE("m.sControlSource") == "C" && this skip bad source
THIS.MyControlSource = UPPER(m.sControlSource)
ENDIF
ENDPROC

ENDDEFINE
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform