I'm coming over from the C# side of things, and it's been over 15 years since I touched Delphi last - so I beg for forgiveness.....
I started a multi-device application with TListBox and got it working, but I now see I probably should have used TListView instead. Is there an EASY way to pass my objects around? I hate having to deal with arrays and ordinal values to keep track of stuff. Seems like we should be way beyond that from a productivity standpoint.
For example, I don't like having to do something like.....
listviewitem.Data:=customObject.Property1;
listviewitem.Data:=customObject.Property2;
listviewitem.Data:=customObject.Property2;
when I should be able to do something like the following.....
listviewitem.Data:=customObject;
then when the user clicks on the detail I handle it in the click event and cast the AItem to a type and go on with life. I feel like I've already got the object in memory, why am I creating all these Data properties that also have to be managed. Am I making too much out of this?
procedure TTabbedForm.PopulateOutstandingDataList();varlistviewitem: TListViewItem;beginListView1.Items.Clear;
transactions:=TObjectList.Create();transactions.OwnsObjects:=True;transactions:=TransactionClass.TTransaction.PopulateOutstandingDataList(creditcards);
for transaction in transactions dobeginlistviewitem:=ListView1.Items.Add();listviewitem.Text:=transaction.TransType + ' from ' + transaction.Merchant;listviewitem.Data:=transaction.TransID;listviewitem.Data:=transaction; <
Why can't I do this?????listviewitem.Accessory:=TAccessoryType.More;listviewitem.Detail:=DateToStr(transaction.TransDate);end;end;
I started a multi-device application with TListBox and got it working, but I now see I probably should have used TListView instead. Is there an EASY way to pass my objects around? I hate having to deal with arrays and ordinal values to keep track of stuff. Seems like we should be way beyond that from a productivity standpoint.
For example, I don't like having to do something like.....
listviewitem.Data:=customObject.Property1;
listviewitem.Data:=customObject.Property2;
listviewitem.Data:=customObject.Property2;
when I should be able to do something like the following.....
listviewitem.Data:=customObject;
then when the user clicks on the detail I handle it in the click event and cast the AItem to a
procedure TTabbedForm.PopulateOutstandingDataList();varlistviewitem: TListViewItem;beginListView1.Items.Clear;
transactions:=TObjectList
for transaction in transactions dobeginlistviewitem:=ListView1.Items.Add();listviewitem.Text:=transaction.TransType + ' from ' + transaction.Merchant;listviewitem.Data:=transaction.TransID;listviewitem.Data:=transaction; <
Why can't I do this?????listviewitem.Accessory:=TAccessoryType.More;listviewitem.Detail:=DateToStr(transaction.TransDate);end;end;