Stepa
2008-09-20 20:55:36 UTC
I have Value List Editor , with combo boxes in Value columns
(EditStyle->esPickList), and they are read-only (user is not allowed
to edit the fields in Value column, but only to select from the combo
box list).
I would like to make sure that user cannot select 2 or more same items
from combo box list in different rows (e.g. values in Value columns
are unique). So if user tries to select the item that's already chosen
in some other row, I want to clear the text from the row where the
item is firstly chosen (precisely value part of the row), but I don't
seem to find the way to do this.
I wrote following code in OnSetEditText handler (Value is argument
that is the item that's chosen in combo box), which is anyway
triggered even though value columns are set to read-only.
for (int i=0; i< ValueListEditor1->Strings->Count; i++)
{
if (Value == ValueListEditor1->Values[i+4]){
ShowMessage("this item is already
chosen");
ValueListEditor1->Values[i+4]="";
//ValueListEditor1->Strings-
ValueListEditor1->Refresh();
}
}
but this doesn't work cause the program is just stuck when it comes to
instruction ValueListEditor1->Values[i+4]="";
Any help?
Thanks in advance,
Dragan
(EditStyle->esPickList), and they are read-only (user is not allowed
to edit the fields in Value column, but only to select from the combo
box list).
I would like to make sure that user cannot select 2 or more same items
from combo box list in different rows (e.g. values in Value columns
are unique). So if user tries to select the item that's already chosen
in some other row, I want to clear the text from the row where the
item is firstly chosen (precisely value part of the row), but I don't
seem to find the way to do this.
I wrote following code in OnSetEditText handler (Value is argument
that is the item that's chosen in combo box), which is anyway
triggered even though value columns are set to read-only.
for (int i=0; i< ValueListEditor1->Strings->Count; i++)
{
if (Value == ValueListEditor1->Values[i+4]){
ShowMessage("this item is already
chosen");
ValueListEditor1->Values[i+4]="";
//ValueListEditor1->Strings-
Values[i]=""; (i tried this line of code instead of previous but it
doesn't work as well)ValueListEditor1->Refresh();
}
}
but this doesn't work cause the program is just stuck when it comes to
instruction ValueListEditor1->Values[i+4]="";
Any help?
Thanks in advance,
Dragan