Mega Code Archive

 
Categories / Delphi / Activex OLE
 

Create an ActiveX friendly TSplitter

Title: Create an ActiveX friendly TSplitter Question: prevent the 'Component has no parent window' error message from appearing when you use a TSplitter in a Delphi ActiveX control. Answer: To prevent the component 'x' has no parent window message appearing when you have a TSplitter contained in your ActiveX control - simply build your own splitter using the following code & use this new splitter, instead. unit ActiveXSplitter; uses Windows, Messages, SysUtils, Classes, Controls, ExtCtrls; (...?) interface type TMySplitter = class(TSplitter) private protected procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; public end; { TMySplitter } implementation uses Consts; procedure TMySplitter.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin try inherited; except on E:EInvalidOperation do if E.Message = SParentRequired then begin // do not respond end; else raise; end; end; This will bypass the error that occurs when the TSplitter tries to run GetParentForm. ..and that's that :) - Simon - Mozzy - Moscrop Full time geek