Larry Hengen 39 Posted September 22, 2019 (edited) I have a TForm descendant that contains a scrollbox, and the form is nested within two panels on the main form of my application. It displays values in a manner similar to the object inspector, and the user needs to be able to edit the values. For some reason, I cannot focus the TLabeledEdit controls using the mouse left button click. Right clicking on the control works and selects all text in the TEdit, but left click does not. I see that a WM_SETFOCUS message is sent, but false is returned. Before I start digging into the the VCL's message handling, I was wondering if anyone might know the cause of such behaviour, or have suggestions on how to best track it down. I just converted the "inspector" form to a TFrame. In doing so I loose some functionality like the ability to close the form, but I can now focus the edit control using the left mouse button, and I also get a right click local menu for the editor. Is there anyway to make the embedded form behave in the same way as the frame with respect to embedded controls? Edited September 22, 2019 by Larry Hengen clarify situation and document new finding Share this post Link to post
Fr0sT.Brutal 900 Posted September 23, 2019 I'd say it's easier to add necessary form functions to frame (adding header and close button shouldn't be too complex) Share this post Link to post
Larry Hengen 39 Posted September 23, 2019 5 hours ago, Fr0sT.Brutal said: I'd say it's easier to add necessary form functions to frame (adding header and close button shouldn't be too complex) Of course you are right. Thanks for the suggestion. Share this post Link to post
PeterBelow 239 Posted September 27, 2019 On 9/22/2019 at 6:26 PM, Larry Hengen said: I have a TForm descendant that contains a scrollbox, and the form is nested within two panels on the main form of my application. It displays values in a manner similar to the object inspector, and the user needs to be able to edit the values. For some reason, I cannot focus the TLabeledEdit controls using the mouse left button click. Right clicking on the control works and selects all text in the TEdit, but left click does not. I see that a WM_SETFOCUS message is sent, but false is returned. Before I start digging into the the VCL's message handling, I was wondering if anyone might know the cause of such behaviour, or have suggestions on how to best track it down. I just converted the "inspector" form to a TFrame. In doing so I loose some functionality like the ability to close the form, but I can now focus the edit control using the left mouse button, and I also get a right click local menu for the editor. Is there anyway to make the embedded form behave in the same way as the frame with respect to embedded controls? Maake sure you set the form borderstyle to bsNone, so it has no caption bar. Windows does not like controls with the WS_Caption window style (and that is what the form becomes when you embed it), they have focus issues likr the one you observed. 1 Share this post Link to post
Larry Hengen 39 Posted September 27, 2019 1 hour ago, PeterBelow said: set the form borderstyle to bsNone, so it has no caption bar. Thanks for the answer. It's always nice to know why. Actually the Caption bar is one of the things I liked about using embedded forms, that and the OnCreate/OnClose events. I have switched things to use TFrame descendants, which works reasonably well, but I had to introduce my own caption bar and deal with the lack of the events I mentioned. Share this post Link to post