Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 9 Jahren, 2 Monaten
Letzter Beitrag:
vor 9 Jahren, 2 Monaten
Beteiligte Autoren:
Al, Shahine, ICI, Piet van Zanten, Andres Sanchez, "Kevin Erskine".pcs.crosspost

Drop Combo

Startbeitrag von "Kevin Erskine".pcs.crosspost am 17.05.2009 07:37

I have a field in my Database table


I want to have a drop combo list containing the following values

But I want to store the actual text in the File not the numeric position.

It seems Drop Combos only return the item number selected and not the value.

How can I do this? What am I missing?

Kevin Erskine
Software By Ragazzi
Alameda, CA (USA)

Message forwarded from pcsoft.us.windev


CBOX_Combo..DisplayedItem (is your text)
CBOX_Combo..value (is your returned value)

I hope this is what you ask for. :cheers:

Or you have to on properties for your ComboBox change returned/Store value.

von ICI - am 17.05.2009 08:34
Hi Kevin,

I find it easier to feed the content of a drop combo from a database table. At first it may seem like an over-kill having a table for each drop combo, but over the years it has saved me a lot of time. My users can control the content of the drop combos without any involvement by me. They just add or remove records to/from a table.

Simply create a table with 2 columns:
1 TXT1 = Text to display in the drop combo
2 POS = An integer fields which determines the position (sort order)

Then on the “Content” tab page of your combo select:
Source for fill = File with direct access (No limit)
Browsed File = Name of your table
Displayed item = (TXT1) Name of your text field
Stored item = (TXT1) Name of your text field
Search item = (POS) Name of the integer field responsible for sort order

That is it. Populate your table with the values you want and you are good to go.

You don’t need to worry about Combo..DisplayedItem or Combo..Storedvalue.
Your normal ‘PagetoFile’ and ‘FiletoPage’ command will take care of everything.

Ps: If you set your (pos) values at intervals of 10 (instead of 1) you will be able to insert 9 extra values, between existing values without having to renumber the whole list.

Learned that one the hard way after I had to renumber a list with 100s of items!

Hope this has been of help.


von Shahine - am 19.05.2009 15:56

You can do it but, you have to enter the values by programming and not on the properties of the control.

ListAdd(COMBO_CCard,"American Express" + gLink("Amx"))
ListAdd(COMBO_CCard,"Discovery" + gLink("Disc"))

also you have to check in the details tab of the combo control the property.

Returns the value specified by gLink

Hope it helps.

Andres Sanchez

von Andres Sanchez - am 19.05.2009 20:44

And don't forget gLinkActivate after that.


von Piet van Zanten - am 19.05.2009 21:12
Hello Shahine

As an alternative to a file per table, use just 2 files, a heade file and a lookups file.

The header file contains the field or control name and a primary key, plus whatever else you may need to control the process . The lookup file is a child to the header file and has the value to go into the combo box, a sort value and the primary key of the header file. This file has as many records as are required to fill the combobox and its primary key is the value that gets stored in your calling file.

To fill a combobox, call a global proc with the name of the field or control, find that record in the header file and then pick up the associated records from the lookup table to fill the combobox.


von Al - am 20.05.2009 03:42
Hi Al,

You are right, that would work.

The only problem I see is that if you have many drop-combos linked to database fields with different sizes, then the field in the ‘child’ table, which will populate the many drop-combos, must be the biggest common denominator.

As I let my users populate the content, they could enter a value which is simply too big for its destination drop combo. I suppose I could add another field to the ‘header’ table which controls and limits the text size of the records added to the ‘child’ table!

Thanks for that.


von Shahine - am 20.05.2009 06:40
Hello Shahine

I don't worry about the size of the combobox. In the editor > details you can set the combobox as resizable and to store the new new size. On first use the user can drag the bottom right hand corner of the combobox to its new size and it will remember that for next time.


von Al - am 20.05.2009 10:06
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.