Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help - Problem making list items 'Selected' in code.
Message
 
 
À
02/10/1998 10:03:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00143236
Message ID:
00143309
Vues:
19
Bill,

This is a known bug, here's the KB article

BUG: Using Selected Method in Init Event Does Not Work
Last reviewed: December 4, 1997
Article ID: Q177340
The information in this article applies to:
Microsoft Visual FoxPro for Windows, versions 5.0, 5.0a


SYMPTOMS
In Visual FoxPro versions 5.x, programmatically using the Selected method to select an item in a list box does not work in the Init method of a list box or a form.



RESOLUTION
Use the following method to programmatically select an item in the Init method of a list box or a form:


Thisform.List1.DisplayValue = Thisform.List1.List(1) && This will select
&& the first item.

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
This problem does not occur in Visual FoxPro versions 3.x.



Steps to Reproduce Behavior

Create a form and named it MyList.

Place a list box object on the form and set the following properties:


RowSourceType = 1 - Value
RowSource = "One, Two, Three, Four, Five" (without the quotations)

In the Init method of the form, type the following code:


Thisform.List1.Selected(1)=.T. && Select the first item.

Save and run the form.
NOTE: When the form runs, no item is selected in the list box.


>Can someone enlighten me on this simple problem:
>
>I have a list box. In the ListBox.Init I put the following code.
>
>this.Selected(2) = .T.
>this.Selected(3) = .T.
>this.Refresh
>
>When the form is run, list items 2 & 3 are not shown as selected. If I run the same code from a command button on the form, it works as expected - the list items are selected. I have tried putting the code in the form.Init and form.Activate as well, with no success. My goal is to have a multi-select listbox which can be initialized to show the currently chosen items as 'selected'.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform