Welcome! Log In Create A New Profile

Advanced

Drop Combo

Posted by "Kevin Erskine".pcs.crosspost 
"Kevin Erskine".pcs.crosspost
Drop Combo
May 17, 2009 09:37AM
I have a field in my Database table

CcType STRING 4

I want to have a drop combo list containing the following values
Amx
Disc
MC
Visa

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
www.Software-By-Ragazzi.com
Alameda, CA (USA)

Message forwarded from pcsoft.us.windev
ICI
Re: Drop Combo
May 17, 2009 10:34AM
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.



Edited 1 time(s). Last edit at 05/17/2009 10:37AM by ICI.
Shahine
Re: Drop Combo
May 19, 2009 05:56PM
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.

Shahine
Andres Sanchez
Re: Drop Combo
May 19, 2009 10:44PM
Kevin:

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
Piet van Zanten
Re: Drop Combo
May 19, 2009 11:12PM
Hi,

And don't forget gLinkActivate after that.

Regards,
Piet
Al
Re: Drop Combo
May 20, 2009 05:42AM
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.

Regards
Al
Shahine
Re: Drop Combo
May 20, 2009 08:40AM
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.

Regards
Shahine
Al
Re: Drop Combo
May 20, 2009 12:06PM
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.

Regards
Al
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: