Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting in a ComboBox
Message
 
To
29/05/2001 15:00:23
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00512344
Message ID:
00517000
Views:
6
This message has been marked as the solution to the initial question of the thread.
Renior,

I really like the combobox source being an array. Reason is that it is easy to fill and sort. Here are some notes on that...

To use a drop down to list one of a kind items, use an array as the rowsource. populate the array with an SQL statement like "SELECT DISTINCT this FROM that INTO ARRAY apick" in the init of the control. The apick array must be created in the control and not the form the control is on. You can create it in the control's init thusly...
if not pemstatus(This, 'aPick', 5)
This.AddProperty('aPick[1]')
endif
* or making it public
public array apick[1]

Then, to have the combo display change when the form is refreshed, you need to code in the form refresh event to update the combo.displayvalue from the current record.
If you intend to allow the user to update the data from an item entered in the combo that is not in the select dictinct (and therefore, the array), you will need to put that check in the valid of the combo.
If this.displayvalue != datarecord.whatever
... Ask if user wants to update and do a replace whatever with this.displayvalue

And, of course, redimension the array one element bigger, insert the new value and resort the array.

This may seem like a lot, but once you get it to work, the effect is really neat.

Hope this helps.
Ron Seidl
Independent Developer
VFP

"I'm playing in life's theater in anticipation of a great cast party!"
Previous
Reply
Map
View

Click here to load this message in the networking platform