Tom Mueller 5 Posted Thursday at 08:15 AM Hallo all I have a control (TWinControl) that contains an other control (TPanel) and registered it in a package (see demo code in the attachment), First Problem: When selecting the control in the IDE, the selection markers are only partially visible. Second Problem: When selecting more than one control, no selection markers are visible at all. Is this a known problem and are there any solutions for it? Thanks Tom TestSelectMarker.7z Share this post Link to post
Tom Mueller 5 Posted yesterday at 02:29 PM To handle this, I could register my own IOTANotifier with a IOTAWizard to get notified when the control is selected, and then draw the markers manually. I found some notifiers for the code editor like TNTACodeEditorNotifier but could not find a proper notifier for the form designer. If anyone has undertaken a similar task, your assistance would be greatly appreciated. Share this post Link to post
Pat Foley 53 Posted 13 hours ago On 2/20/2025 at 2:15 AM, Tom Mueller said: I have a control (TWinControl) that contains an other control (TPanel) You need to add the paint event to draw the control in the IDE plus WMSIZE to allow sizing of controls being drawn. Changing to descend from Tpanel allows working control base to add control to. Later the control can be switched to TCustomControl or TWinControl. unit uTestSelectMarker; interface uses Classes, Vcl.Controls, Vcl.ExtCtrls, Winapi.Messages; type TTestSelectMarker = class(TPanel) //change to TcustomControl or TWinControl private FPanel: TPanel; protected procedure Paint; override; procedure WMSIZE(var message:TWMSIZE); message WM_SIZE; public constructor Create(AOwner: TComponent); override; end; procedure Register; implementation uses Graphics; constructor TTestSelectMarker.Create(AOwner: TComponent); begin inherited;// Create(AOwner); Color := clBtnFace; FPanel:= TPanel.Create(self); // FPanel.SetSubComponent(True); // Uwe mentioned this in SO post FPanel.Parent:= self; FPanel.BevelOuter:= bvNone; FPanel.Color:= clCream; FPanel.Visible := True; end; procedure Register; begin RegisterComponents('Test', [TTestSelectMarker]); end; procedure TTestSelectMarker.Paint; begin inherited; FPanel.Caption := Name; end; procedure TTestSelectMarker.WMSIZE(var message: TWMSIZE); begin FPanel.setbounds(10,10,Width- 2 * 10, Height - 2 * 10); end; end. Share this post Link to post
Tom Mueller 5 Posted 12 hours ago (edited) Thank you for your response. I noticed that you reduce the size of the sub-control to display the markers correctly. This works but unfortunately, this approach prevents the sub-control from being displayed at its desired size. In my case, the sub-control can be of type TEdit, TCheckBox, TComboBox, TDateTime or TMemo, and it is essential that they maintain their correct size at design time. By reducing the sub-control size, a correct form layout is not possible, and it would look like: Or, is there a way to reduce the size of the sub-component only when more than one control is selected? Edited 11 hours ago by Tom Mueller Share this post Link to post
Pat Foley 53 Posted 5 hours ago 6 hours ago, Tom Mueller said: I noticed that you reduce the size of the sub-control to display the markers correctly. I should have included this procedure TTestSelectMarker.WMSIZE(var message: TWMSIZE); begin // FPanel.setbounds(10,10,Width- 2 * 10, Height - 2 * 10); Fpanel.Align := alClient; end; Share this post Link to post
Tom Mueller 5 Posted 4 hours ago Thanks for your effort but you can see the partial markers only because the panel has a border of 1 pixel (due to BevelOuter=bvRaise). Set BevelOuter=bvNone the markers are hidden completely again. Share this post Link to post
Pat Foley 53 Posted 3 hours ago To reveal the markers add to source or set in Object Inspector BorderWidth = 5 Share this post Link to post