kabiri 3 Posted November 25, 2023 I have created a component for FMX. This component has an internal list. I want to fill this list with database values. (Using the livebinding method.) I have derived my component from (TPresentedControl, IItemsContainer). If I derive my component from stringgrid, everything works, but I don't want to do that. (My component is not similar to stringgrid.) I'm not sure, but I think I can do this with observer. But I don't know how. If you have a solution for this, I would appreciate your guidance. Share this post Link to post
Serge_G 87 Posted November 28, 2023 have a look at http://docwiki.embarcadero.com/RADStudio/Seattle/en/Tutorial:_Creating_LiveBindings-Enabled_Components in short, you need to declare these procedures and function in your component code procedure ObserverToggle(const AObserver: IObserver; const Value: Boolean); protected function CanObserve(const ID: Integer): Boolean; override; procedure ObserverAdded(const ID: Integer; const Observer: IObserver); override; and do some register observable members If you read French, I wrote some tutorials (part I, part II) Share this post Link to post
kabiri 3 Posted November 28, 2023 1 hour ago, Serge_G said: have a look at http://docwiki.embarcadero.com/RADStudio/Seattle/en/Tutorial:_Creating_LiveBindings-Enabled_Components in short, you need to declare these procedures and function in your component code procedure ObserverToggle(const AObserver: IObserver; const Value: Boolean); protected function CanObserve(const ID: Integer): Boolean; override; procedure ObserverAdded(const ID: Integer; const Observer: IObserver); override; and do some register observable members If you read French, I wrote some tutorials (part I, part II) Thank you for your response. Yes, I have seen it. It just sets a property to receive information from livebinding. In the photo I sent, I do not want the position property to be added. I want the * option to be added. This photo : https://docwiki.embarcadero.com/images/RADStudio/Seattle/e/1/13/LBTTrackBar3.png Share this post Link to post
Serge_G 87 Posted November 29, 2023 Ah, the "synch" one ! I never search for this one. In my mind you need at least to declare in your code procedure ObserverToggle(const AObserver: IObserver; const Value: Boolean); protected function CanObserve(const ID: Integer): Boolean; override; Then check a unit like FMX.Listview.pas (searching 'observer') EditLinkID, PositionLinkID and IteratorLinkID (from System.Classes) seems to be the keys Share this post Link to post
kabiri 3 Posted November 29, 2023 1 hour ago, Serge_G said: Ah, the "synch" one ! I never search for this one. In my mind you need at least to declare in your code procedure ObserverToggle(const AObserver: IObserver; const Value: Boolean); protected function CanObserve(const ID: Integer): Boolean; override; Then check a unit like FMX.Listview.pas (searching 'observer') EditLinkID, PositionLinkID and IteratorLinkID (from System.Classes) seems to be the keys Thank you I'll check it. Share this post Link to post