Information générale
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Network:
Windows 2003 Server
>I have a listbox.
>
>I want to preselect items in the listbox in the Init method of my form. the MultiSelect property is .T.
>
>I populate the listbox with a cursor, and then set individual Selected(i) = .T., for one or more entries.
>
>This appears to actually cause those items to be selected, but the selections lack the blue highlighting.
>
>When the user then clicks on items, the items clicked on do highlight.
>
>How do I get the programmatically selected items to appear highlighted.
>
>Thanks,
>Jim
I finally got this working, but I am not sure why.
I previously was populating the listbox using a cursor (RowSourceType = 2-Alias). I tried that in the form init method but also in the listbox init method. I selected items in the listbox in the form Init method, listbox init, and probably some other places. But none of this worked.
What finally worked was to populate the grid using AddItem methods in a scan loop using the same cursor. RowSourceType = 0-None. I located this code in the listbox Init method. pre-Selection of items in the listbox continues to be the form Init method.
This works: when the form comes up, the pre-selected items in the listbox are highlighted.
Thanks to Naomi, Koen, and Hugo for taking the time to consider my problem and posting suggestions.
Jim
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement