Combobox refresh

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

User avatar
serge_girard
Posts: 2484
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Has thanked: 780 times
Been thanked: 147 times
Contact:

Re: Combobox refresh

Post by serge_girard »

Thanks Theo !
Serge

User avatar
Rathinagiri
Posts: 5287
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 178 times
Been thanked: 196 times
Contact:

Post by Rathinagiri »

Thanks.

Why do you use asort() after the combobox refresh?
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

trmpluym
Posts: 264
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 8 times
Been thanked: 35 times

Post by trmpluym »

Rathinagiri wrote:Thanks.

Why do you use asort() after the combobox refresh?
Rathi, it should be in front (because i like my Comboboxes sorted). Thanks for keeping me sharp :D

Code: Select all

FUNCTION RefreshCombobox(cWindowName,cComboBoxName,aArrayName)

LOCAL nX

DoMethod(cWindowName,cComboBoxName,'DeleteAllItems') 

aSort(aArrayName)

FOR nX = 1 TO LEN(aArrayName)
   DoMethod(cWindowName,cComboBoxName,'AddItem',aArrayName[nX]) 
NEXT

Return

User avatar
Rathinagiri
Posts: 5287
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 178 times
Been thanked: 196 times
Contact:

Post by Rathinagiri »

There is already a feature in combobox - 'Sort' enabled. It is automatically sorted even if you enter in different order.

Just FYI.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.

trmpluym
Posts: 264
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 8 times
Been thanked: 35 times

Post by trmpluym »

Thanks Rathi !

User avatar
jairpinho
Posts: 361
Joined: Mon Jul 18, 2011 5:36 pm
Location: Rio Grande do Sul - Brasil
Has thanked: 3 times
Been thanked: 11 times
Contact:

Post by jairpinho »

Thank you, it worked.


trmpluym wrote:I created a small universal function for the refresh of a ComboBox with a one dimensional array source.

It is simple but maybe it can help some others :)

Code: Select all

FUNCTION RefreshCombobox(cWindowName,cComboBoxName,aArrayName)

LOCAL nX

DoMethod(cWindowName,cComboBoxName,'DeleteAllItems') 

FOR nX = 1 TO LEN(aArrayName)
   DoMethod(cWindowName,cComboBoxName,'AddItem',aArrayName[nX]) 
NEXT

aSort(aArrayName)

Return
Jair Pinho
HMG ALTA REVOLUÇÃO xBASE
HMG xBASE REVOLUTION HIGH
http://www.hmgforum.com.br

Post Reply