Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Combo Box not shown up in Value List Editor

175 views
Skip to first unread message

Foo Tze Wan

unread,
May 9, 2005, 5:57:58 AM5/9/05
to
Hi all,
I am using the TValueListEditor (similar to the Object Inspector) in BCB6. I
would like to have a combo box listing all the values for a specific key in
the value list editor. This will allow the user to select the desired value.
My problem is the combo box does not shows up.

The following are snap shots of my code:

In the OnShow event of the form that contains the TValueListEditor,

TStringList *DepartmentStringListPtr;
AnsiString department_name;

DepartmentStringListPtr = new TStringList; // Create a string
list.

// I then fill up the string list using:
(for i= 0; i < xx; i++)
{
department_name = GetDeptName(i); // Read from database
DepartmentStringListPtr->Add(department_name);
}

// I have this statement so that the key name ("Department") can be
displayed.
ValueListEditorEmployee->Strings->Add("Department=");

// Set the edit style and assign to the picklist.
ValueListEditor1->ItemProps[0]->EditStyle = esPickList;
ValueListEditor1->ItemProps[0]->PickList = DepartmentStringListPtr;


I would appreciate any assistance. Thanks.

Sincerely,
Tze Wan

Remy Lebeau (TeamB)

unread,
May 9, 2005, 1:41:21 PM5/9/05
to

"Foo Tze Wan" <tw...@autostar.com.sg> wrote in message
news:427f...@newsgroups.borland.com...

> TStringList *DepartmentStringListPtr;

You don't need a separate TStringList. You can read your values directly
into the ItemProps::PickList.

> ValueListEditorEmployee->Strings->Add("Department=");

You are adding a value to 'ValueListEditorEmployee', however...

> ValueListEditor1->ItemProps[0]->EditStyle = esPickList;
> ValueListEditor1->ItemProps[0]->PickList = DepartmentStringListPtr;

... you are then adding your PickList items to 'ValueListEditor1' instead.
Is that a typo on your part, or does your code really do that? Always
copy/paste your actual code as-is from your code editor whenever you post
code to these newsgroups, if you are not already.

Assuming the PickList items do actually go to the same ValueListEditor that
the key is being added to, then I cannot reproduce the issue using your
code. It works fine for me when I try it.


Gambit


Foo Tze Wan

unread,
May 10, 2005, 2:06:18 AM5/10/05
to
>... you are then adding your PickList items to 'ValueListEditor1' instead.
>Is that a typo on your part, or does your code really do that? Always
>copy/paste your actual code as-is from your code editor whenever you post
>code to these newsgroups, if you are not already.


Thanks Gambit for your reply. I should have cut and paste the actual code...

Anyway, I have discovered the part where I have gone wrong. Under the
Options | goEditing, I had originally set to FALSE. The reason behind was I
wanted a drop down combo box, where the user is only allowed to select, but
not allowed to edit the values. This results in the combo box not showing
up...

By setting goEditing to true and setting the following ReadOnly property
such that :-

ValueListEditorEmployee->ItemProps[0]->ReadOnly = true;

I have obtained what I needed. The combo box shows and is read only.

Thanks for the trouble to test out at your side.

Regards,
Tze Wan


0 new messages