Mauri Posted September 26, 2016 Posted September 26, 2016 I am starting to use the UniGUI framework and I'm creating a new child component inherited from TUniDBLookupComboBox. In this component I need some different behaviors and one of them is an additional research. I have this same component running on the VCL and it creates a query component in the component creation event, making it easier for the programmer does not need to add a TQuery component for each Lookup! I wonder if I can do this using UniGUI as reading the forum I realized that the data connection components need to be in specific places (MainDataModulo or Form)! I'm asking this because my component is giving a memory error and do not know if this is related to ownership of the built in component TQuery Best Regards Mauri Sample: ====== TDBLookup = class(TUniDBLookupComboBox) private fQuery: TSQLQuery; function SearchRecord: boolean; ... protected ... public constructor Create(AOwner: TComponent); override; destructor Destroy; override; published ... end; procedure Register; implementation constructor TDBLookup.Create(AOwner: TComponent); begin inherited Create(AOwner); fQuery:= TSQLQuery.Create(Self); ... end; destructor TDBLookup.Destroy; begin try if Assigned(fQuery) then FreeAndNil(fQuery); finally ... end; inherited Destroy; end; function TDBLookup.SearchRecord: boolean; begin try fQuery.sql.text:= 'Select field from table where ...'; fQuery.open; ... finally end; end; procedure Register; begin RegisterComponents ('COMPS',[TDBLookup]); end; initialization finalization end. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.