Combobox refresh

Topic Specific Tutorials and Tips.

Moderator: Rathinagiri

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

Re: Combobox refresh

Post by serge_girard » Sun Nov 20, 2016 12:59 pm

Thanks Theo !
Serge

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

Post by Rathinagiri » Sun Nov 20, 2016 2:35 pm

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: 253
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 6 times
Been thanked: 27 times

Post by trmpluym » Sun Nov 20, 2016 3:03 pm

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: 5268
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Has thanked: 171 times
Been thanked: 174 times
Contact:

Post by Rathinagiri » Sun Nov 20, 2016 4:18 pm

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: 253
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands
Has thanked: 6 times
Been thanked: 27 times

Post by trmpluym » Sun Nov 20, 2016 7:55 pm

Thanks Rathi !

User avatar
jairpinho
Posts: 348
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 » Mon Nov 21, 2016 12:46 am

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