Everything works normally except the following:
If you drop down the list and use the scroll bar up and down buttons to move
through the list, the cost component changes, but the value of the
dbLookupComboBox and the highlight in the drop down box do not change.
Therefore, when you close the combo box without selecting anything new, the
cost does not reflect the initial inventory item any longer. It displays
the cost of some other inventory item which it received while scrolling
through the list.
I really do not want the cost to change while scrolling through the list in
this manner if the highlight is not going to move along with it. Any ideas
on how to circumvent this problem will be greatly appreciated!
Thanks,
Debra Paulsen
10Hz, Inc.
Write an OnCloseUp event handler for the DBLookupComboBox. In that
handler, set the record pointer back to the DBLookupComboBox key value:
Table1.findkey([DBLookupComboBox.keyvalue]);
Debra Paulsen said something like...
|I am using TdbLookupComboBox to display inventory items. When I pick an
|item, I have another TdbEdit which displays the cost of that inventory item.
|
Any other ideas would be greatly appreciated.
Thanks,
Deb
lj wrote in message ...
Since you stated that the key value does not change if they didn't
actually pick a new item, then the solution is to save the starting key
value and compare it to the final key value. You can get the start key
value in an event handler for the OnDropDown event.
Compare the saved start key value to the key value you get in the
OnCloseUp event.
procedure TFORM1.DBLookupComboBox1DropDown(Sender: TObject);
begin
FLastKey := DBLookupComboBox1.Text;
end;
procedure TFORM1.DBLookupComboBox1CloseUp(Sender: TObject);
begin
if FLastKey = DBLookupComboBox1.Text then
table1.FindKey([FLastKey]);
end;
Debra Paulsen said something like...
|This would work fine, except I don't know whether the key value changed
|because they actually picked a new item or whether it changed because of a
|scroll through the list (they didn't actually pick a new item).
|
|
|lj wrote in message ...
|>
|>Write an OnCloseUp event handler for the DBLookupComboBox. In that
|>handler, set the record pointer back to the DBLookupComboBox key value:
|> Table1.findkey([DBLookupComboBox.keyvalue]);
|>
|>Debra Paulsen said something like...
|> |
I was able to use your idea with a little more of a work-around. I actually save
the text, not the key, on enter. If the text did not change on close up, then I
do the find key. If it did change, then I set the text to the new text. A bit of
a band aid to the problem, but it will work for now.
It doesn't solve the problem of the cost changing as you scroll even though the
item is not changing. At least after they are done, the cost and the item match
now, which is better than what I had before.
Thanks for the help! It is greatly appreciated!
Deb
Deb Paulsen said something like...