I have created a few custom Enumerator-Sets.
Example:
Type TStatus=(Unknown=0, Dead=1, Owned=2, Borrowed=3);
Now I want to fill a Combobox with all the Items defined in my Set. So my fist thought was to use the TypeInfo, GetEnumName and GetEnumValue-Functions.
i:=0;
while GetEnumValue(TypeInfo(TStatus),GetEnumName(TypeInfo(TStatus),i))<>-1 do
begin
status:=GetEnumName(TypeInfo(TStatus),i);
ComboBox.Items.Add(status);
inc(i);
end;
(I tried binding a TStringList to the ComboBox with a seperate Adapter but that didn't work).
After filling my ComboBox I went on to use LiveBindings to bind the property "SelectedValue" to the TStatus-property of my Object, which is simply called Status.
property Status:String read GetStatus write SetStatus;
there are three problems though.
The Combobox shows no Value when I scroll through my Objects even though I assigned a default value to the Status-property.
the Amount of Items in the combobox is:
Amount of Items in Set + Amount of Objects
So if I have 2 Objects I have 6 Items in my Combobox when it should remain at 4
If I select a Value from the combobox and want to Post it to my Object it doesnt access my Setter-Function.
This whole Live Bindings stuff is still new to me but I'd like to learn it properly.
So if you could help me solve these issues, it would be appreciated.
Thank you for your time.
Edit: My Delphi-Version is 10.1 Berlin and I use VCL, Target Platform is Windows only.
Edit2: https://www.dropbox.com/s/u7znetur723q6i2/DBApp.7z?dl=0 here are my project files.