Jump to content

arend

Members
  • Content Count

    4
  • Joined

  • Last visited

Everything posted by arend

  1. This might be a bit long-winded but basically I'm looking for some pointers for developing a new project. I am using RAD Studio 11, using both Delphi and C++ Builder, although I have more experience in C++. Previously I have been downloading data from a JSON API, processing the JSON into separate objects (mainly just containing strings), adding those objects to a TList and displaying them using a custom TListBoxItem object in a TListBox. This works fine but is slow to process, save, load, filter and display (i.e. need to create a new TListBoxItem for each object and populate manually, and save/load from a custom text file format). For future projects I would like to use something like a TClientDataSet or TFDMemTable but don't have much experience with them. I have gotten to the point where I can populate a TFDMemTable with arbitrary JSON downloaded from my API and displaying that using design time LiveBindings on a TStringGrid. My query boils down to how I would display my data using a TListBox with much more information than the default TListBoxItem can show (i.e. more than two strings, multiple icons/pictures, etc.), or if there is another better/easier way to handle this. Would I create my custom TListBoxItem object and bind it programmatically somehow? Use a style book to create a custom layout? Some other process I'm not aware of? I don't have much experience with the database objects in RAD Studio or the live bindings but this seems like the way to go to make my applications snappier and quicker for users. Any pointers would be much appreciated.
  2. arend

    Custom TListBoxItem Live Bindings Advice

    I could but have found that to be quite limiting compared to the custom TListBoxItem, i.e. if I wanted edit boxes, combo boxes, animations, drag-drop functionality, etc.
  3. arend

    Custom TListBoxItem Live Bindings Advice

    So in this instance what would you suggest? How can I get a list box filled with a custom TListBoxItem using live bindings or similar method? As a very basic example, here's how I currently do it: // create a custom TListBoxItem class (this one will only have one button but mine have multiple layouts, buttons, animations, etc.) class TListBoxCustom : public TListBoxItem { __published: TButton *FButton; __fastcall TListBoxQueue(TComponent *Owner) { FButton = new TButton(this); FButton->Parent = this; }; } // when I need to populate a list box i loop and instantiate: for(int i = 0; i < 100; i++) { TListBoxCustom *item = new TListBoxCustom (parent); item->Parent = parent; item->FButton->Text = (UnicodeString)i; item->FButton->OnClick = ClickHandler; } If I do live binding at design time I see no way of binding to custom list box items, either using style books or other methods, and I'm not sure at all how to do it at run time. Is it possible at all or do I need to stick with my current slow method?
  4. arend

    Custom TListBoxItem Live Bindings Advice

    Thanks for that breakdown, but I was looking for some more specific information. I guess I should have been more specific. I am currently using FMX as I am creating cross platform applications for PC and mobile. Mainly I would like to know how (or if) I can use an FDMemTable with custom ListBox items. Currently I am defining a custom TListBoxItem class with internal variables, procedures and functions, and then individually instantiating them manually to populate from a list of data. I am just looking for pointers of ways to do this using live bindings or some other method that doesn't require me to loop through a list and populate manually, as this makes my applications quite sluggish. I have looked at: Programmatically live binding my table to my custom TListBoxItem object but haven't been able to get this working, not even sure if it is possible. Using a style book to define a custom list box item style, which I can get to work but is rather limiting. Some of my list box items have parts that users can click to expand/contract and other functions that don't seem possible with this method. Maybe I'm not understanding live bindings correctly or am missing some method that will let me do what I need. Hope that gives more insight into my query. Thanks again.
×