Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combo refuses to have a displayvalue - bug?
Message
 
 
À
30/07/2004 09:39:15
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00783781
Message ID:
00929684
Vues:
20
>>>Nasty little beast of a bug.
>>
>>I have gotten burned by this.
>>If the ControlSource is numeric, I needed code like below.
>>But I'm still not sure where it should go.
>>It's worked in EITHER the form.gotFocus(), comboBox.GotFocus(), or in a pageFrame.page.Refresh()!
>>
>>*!* If ControlSource is numeric, DisplayValue often became blank.
>>*!*	  To fix, put this in form.GotFocus().
>>*!*         - Or you may need to put in THIS.LostFocus():
>>LOCAL liIndex
>>WITH THISFORM.cboProblem
>>   FOR m.liIndex = 1 TO .ListCount
>>     IF VAL( .List[m.liIndex] ) = substitute_controlSource_here ;
>>        AND .ListIndex <> m.liIndex
>>	  * Reset this prop.
>>	  .ListIndex = m.liIndex
>>	  EXIT
>>     ENDIF
>>  ENDFOR
>>ENDWITH	
>>
>
>I think this should go into cbo.refresh, but then I can't be sure it will fire at all the risht times.
>
>Another trick which fixed a similar problem with displayvalue for a dropdown combo on a container was to keep the combo as dropdown list, then in .gotfocus() to set it to dropdown combo, and reset in .lostfocus() again. The problem in this case was that the displayvalue (and the user-editable text in it) was limited in length to the length of the controlsource, even when the bound column was 2. So I had a 16 char controlsource and supposedly a 60 char displayvalue, but when it was being edited, it would get cut to 16 chars on when lostfocus() fired. The swap between dropdown list/combo/list did the magic in this case.

I tried my form without the code above, and now it works fine.
The difference is that now I set comboBox.Value = 1 when adding a new rec.
As a consequence, the combobox.Value is never = 0.

Thanks for the info. on you display length problem.
I have added that to my "watch out for these combobox traps" comments.
- Andy Rice
San Diego, CA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform