I docked two forms on a panel.
It will create a splitter automatically.
Is it possible to get the handle of the splitter using code?
No, it's not possible to get the handle of that control. Splitter controls descend from TGraphicControl, so they do not have window handles.
Whatever your reason for wanting a handle, you'll need to find some other solution to the problem you thought it would solve.
Related
I am attempting to develop my first proper custom control for the Firemonkey framework and have ran into what may possibly be an obvious (or not) solution.
Inside my Firemonkey control I have declared FPanel: TPanel; which is then created in the constructor and freed in the destructor. The panel is created along with my control when I add it to a new Multi-Device Form without any problems.
By default the TPanel has borders around the sides of the control which I do not need in my control.
So my question is, what is the ideal way to remove the borders of a TPanel which is child to my custom control? I could not see an obvious property to change, unless I am mistaking I believe we must modify the style of the panel which I assume would be done via a TStyleBook.
Am I right then in thinking that I need to add a TStyleBook to my control, and from there add the panel to the Style book and modify it this way? Unless I am missing something this seems like a lot of extra work for what should be a very quick and simple change.
Assuming this is the correct way, is there an example of modifying a TStyleBook through code?
Thanks.
Because all Firemonkey controls can be parents, one way is to not use TPanel at all and instead replace it with another Firemonkey control such as the TRectangle shape.
The TRectangle shape can then be customised directly through its properties to remove the border which can be achieved by setting the Corners and Sides to False.
Additionally if you don't require any borders whatsoever then the TLayout control behaves just like a TPanel but without the borders.
To thwart the nit-pickers, let me start with, I searched here with this and could not find an answer, and yes, also I did scroll through the "Similar questions."...
Adding shortcuts to a TForm
I want to drag and drop some shortcuts from the Desktop to a TForm in my application. I am using Anders Melander's brilliant Drag Drop Suite (DDS).
I tried putting a TImage on the form but the DDS does not drop to an Image so I added a TPanel with a TImage on it. I could then drop on the panel and assign the image to the TImage.Picture. Problem was the Panel has no Transparent Property so the shortcut on the form looks clunky with the visible Panel behind it.
I need to be able to drop to the TImage or make the underlying TPanel transparent.
Can anyone help with code-snippets for either of those options, or better yet, a method of dropping a Shortcut directly on to my Form.
Thanks
Coincidentally I needed to make a TWinControl (the base for every visible control with a window handle, including TPanel) transparent. I found numerous results and applied them to this answer.
It's been a while since I implemented drag and drop, but I assume you call some API and pass it the handle of the panel? That answers the question why you can't use TImage. TImage is a graphic control, a control without a handle, that relies on its parent for recieving messages and drawing itself.
It should be possible to use the form, though, since that has a handle too.
If the TImage is directly on the TForm, then let the TForm handle the drop, no TPanel needed. OLE Drag&Drop operations (which Ander's components implement) provide coordinates where dragging and dropping occurs. The TForm should be able to detect when a drag is over the area occupied by the TImage and what type of data is being dragged, and only allow dropping of supported types within that area, extracting the dropped data and updating the TImageas needed, and denying anything else that does not match that criteria.
I’m using Delphi’s 'regular' docking (with DockSite = True and UseDockManager = True). Now there’s several DockSite controls, and several dockable forms. However, not each dockable form is supposed to go in each dock site.
The forms know what kind of control they’re supposed to dock onto; the controls, OTOH, don’t know what form to accept or not.
My problem, now, is that there’s several events going off where you can cancel a drag/drop (or drag/dock) operation: DragOver, StartDock, etc. But those all occur on the 'receiving' side, never on the side of the control that’s being dropped; and that’s where I’d like to have it — so that the form being docked can refuse being docked to a certain control.
Is there such an event, am I overlooking something, or would I have to tackle this in a different way?
I figured I should add this as an answer instead of just a comment. Create a base form for your custom forms and put your logic in that. Then each control would simply have to know how to interact with one form class. Each new docking form you make would have to descend from this base form. The beauty of this is that you will not need to make custom versions of your controls since everything can be handled through the standard event handlers.
The OnStartDock event is fired for the control/form that is being docked, not for the DockSite control that is being docked onto. So you can assign an OnStartDock event handler to your dockable forms, or better override the virtual DoStartDock() method.
Does an alternative exist for TCategoryPanelGroup or TPageControl? My problem is I use a CategoryPanelGroup on a PageControl, therefore there is an enormous flicker which I can not prevent (using DoubleBuffered, disabling a ParentBackground and other things).
I use TPageControl as panels, to show/hide groups of controls.
If you don't need to show tabs, don't use a page control.
I'm looking after a way to AlphaBlend a child form, if possible using layered windows as there will be interactive controls behind it.
The problem is I have a component in a regular TForm that paints multiple visual layers (drawings, pictures...). At some point I need to instantiate an editor control on this form (in-place), this control will involve a variety of standard input controls outside of my control (edit box, check box, etc.), however I would like to overlay the layers in front of the layer being edited using alpha blending (and WS_EX_TRANSPARENT to make it click-through).
I first thought of using child forms for that (borderless TForms parented to the component), and that works alright, up to the point where the AlphaBlended TForm isn't alphablended at all, but turns opaque as soon as parented...
I then tried to unparent the alphablended form, set it to fsStayOnTop, and by reacting to the relevant events, keep it in front of the component on screen, that works, but that isn't a truly satisfying solution: the alphablended StayOnTop form is also in front of other modal and modeless forms of the application, should the user decide to move them in front of the component...
So, any other ideas on a way to have a child form be alphablended? (or behave like it is)
According to MSDN you are out of luck, as WS_EX_LAYERED cannot be used for child windows.
Maybe you could hide all editor forms when your form / application loses focus, that would at least keep them from being on top of other windows. Still, it's unsatisfactory...