Rob,
>How did the values get into the combo box in the first place? Updating a
>value should be very similar to setting it.
A dialog window is called and on create the comboBox is populated with, for
example,
with combobox1.Items do
begin
AddObject('Grid Background', TObject(MyGrid.Color));
AddObject('Grid Lines', TObject(MyGridLines.Color));
AddObject('The Memo', TObject(MyMemo.Color));
end;
In the dialog, if the user selects 'Grid Background' from the combobox, they
get a preview of the current color in a TShape. Now if they want to change
the current color by selecting a color from a color control, I want that
selected color to update:
'Grid Background', TObject(MyColorControl.SelectedColor)
So that if they are making a few changes to the colors from the list, the
colors are reflected in the TObject, so that if they are still in that
dialog and select a changed item, the changed color is displayed in the
Shape control.
Mike
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Rob Kennedy
Sent: Saturday, 24 September 2005 2:51 PM
To: Borland's Delphi Discussion List
Subject: Re: Updating an onject value
Mike Lucek wrote:
> What is the best way to update an object value in a combobox to another
> value?
How did the values get into the combo box in the first place? Updating a
value should be very similar to setting it.
> For example, I have a list of controls that a user can change the
> colour of. The controls are listed in a combo and the current colour is
> associated with each item in the combo. If the user selects a control name
> from the combo, it displays the current colour of the control.
If the user is selecting items in the combo box based on the name of a
control, then the combo box is displaying the names of the controls, not
their colors. Are you saying that once the user makes a selection, the
combo box stops displaying names and starts displaying colors instead?
That's awfully confusing.
> If the user
> changes the colour, how can the object value in the combo be updated to
the
> new colour value?
Combo boxes holds lists of strings. Those strings can have TObject
references associated with them. This works just like a TStringList,
which has both Strings and Objects array properties. They work the same
way because both the combo-box item list and TStringList descend from
TStrings. I'm not really sure what you're trying to do, but does this
additional information about the nature of combo boxes' storage help?
--
Rob
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi