I have an application made with frames.
I have a panel on the frame that I need to work out how to float and dock.
I'm not sure how to accomplish this.
I looked at devexpress docking controls, but they only work with forms.
So I think I need to work out 2 issues.
how to make the panel movable and resizable.
how to add docking logic to a frame?
any help will be appreciated.
1) TPanel movable and resizable
A Panel is always movable inside its container (Form, frame, another panel, scrollbox,...) and resizable. You just have to change its Top, Left, width and height properties. To make it dragable, you need to use MouseDown, MouseMove, MouseUp event, detect and handle the required mouse use to drag.
You can even move the TPanel from its container to another container by changing its Parent property. For example, you can move a panel from a TForm to another TForm. That's what you'll use for making your panel floating.
2) Floating TFrame
You cannot use a TFrame as a floating form. You need a TForm for that.
Note that you can use a TForm much like a TFrame. Use CreateParented to create the form and attach it to a container like a TFrame.
Related
I have 4 cxgrid into a cxTabSheet, 3 aligned albottom and 1 aligned alClient...
When the mouse is over the edge of any cxgrid, the cursor mouse doesn´t change to the crSize(NS, WE, NESW, NWSE) and cannot select the border of grid for drag the mouse and resize it.
How can I do this?
The easiest way to do this, without writing any code, is to use one or more splitters on your form: see TSplitter and the Devex custom version, TcxSplitter, in the online help.
To use, place one or more splitters on the form orientated to allow resizing of the grid(s) as you wish, then place the grids on the appropriate areas of the splitters, or on panels on the splitters. One splitter can be placed inside another, so that you can have one resizable area inside another.
This question applies to two scenarios.
(1)
The first is having a MDI Form and MDI Child, At runtime if I try to resize the Form either horizontally or vertically I cannot go past the edge of the main MDI Form, somewhere there must be a SetBounds or something similar that prevents this type of behavior as the mouse just snaps to the edge.
What I would like is to be able to resize past/outside the MDI Form bounds rect - which would then show the scrollbars on the main MDI Form (just like when you move a Child Form around).
(2)
The second is I find the scrolling within a MDI layout application a bit annoying and not very pleasing to use, so instead of using MDI I thought I could simulate it by setting a Form inside a TScrollBox, doing this I hoped would give more better fluid scrolling. But as with the first scenario placing a Form inside a ScrollBox still does not allow resizing outside the client - and doing this method does not even show the scrollbars when you move the Form around the ScrollBox.
You can try this very quickly by making a new MDI Application. Try resizing using the bottom right corner and dragging as far to to the right/bottom as you can, the Mouse stops at the main MDI client preventing outside resizing.
So how can I allow at runtime, a Form whether it be a MDI Child or parent to a TScrollBox to be resized outside the parent bounds?
Is there a simple property I need to set that I may have overlooked or does it require more work to do such as overriding the Form's messages maybe?
MDI children are not bound by their parent's size, but they are not visible outside their parent's boundaries and therefor cannot be resized outside of those bounds.
However, you can move them outside of the boundaries, so if you move your child form to the left, leaving only a part of the form visible, you can then resize that visible part upto the boundary of the parent. So there's no really a limit in size, but it's just a functional limitation that you cannot further size the form when it's size handles/borders would become hidden.
I think, rather than placing the MDI child on a scrollbox or resizing the MDI child, you could better put the contents of the child on a scrollbox and leave the child form itself as is.
Or, of course, you could revise the design so that you don't need the scrolling at all, but it's impossible to give a proper advise without knowing your form.
FireMonkey's predecessor advertised that it could be used to create CAD and GIS programs. I've been exploring FireMonkey and thinking about how to create a simple CAD program. A basic function is to move shapes around on the screen using the mouse. FireMonkey includes a TSizeGrip component, which I suspect may be applicable to moving shapes and providing nodes at corners and edges of a shape for a user to click on. However, the documentation for TSizeGrip hasn't been completed.
Can TSizeGrip be used to allow end-user movement of FireMonkey shapes? If so, how?
No.
TSizeGrip is provided specifically to act as a "grab handle" for resizing a form, not arbitrary FireMonkey controls or containers.
You can see this quite easily by creating a new FireMonkey HD application. Drop a TPanel on the form and then drop a TSizeGrip onto that panel.
Run the application and you will find that when you mouse over and click on the size grip and drag, the form is resized, not the panel. A size grip control would normally be anchored to the lower right of a form.
If you are wondering why you need a control with such apparently limited use when resizable forms can just be resized using their border, the answer is that it can sometimes be useful to have a form be resizable without having the full draggable border style. e.g. modal dialog boxes.
No - with one exception.
If you create a new component in which you use TPanel and TSizeGrip – TSizeGrip will control TPanel's size, not TForm's size.
If you put TPanel and TSizeGrip on a Form
the TSizeGrip controls the size of the form and NOT the panel
I've just tried it
I am using a 3rd party control which is descended from TComponent and I want it to have scrollbars, preferably autoscrollbars.
Can I get them from TComponent?
Failing that, can I place a TPanel on my mainform & the component on that and get scrollbars? I intend to have the component (and Panel, or whatever) be alClient so that they autoresize when my component resizes, but I woudl also like them to have (auto) scrollbars.
If I understood what you're intended to do, do this:
add a TScrollBox on the form
add visual components on the TScrollBox component
don't worry about scroll bars, because they will be shown automatically when needed(when a component is out of the visible area)
have fun!
For visual controls you usually descend from TControl or (better) TWinControl. TWinControl is a wrapper around Windows controls (widgets), and Windows can provide scrollbars for contents. You might want to look at TScrollbox source code as a guide or a replacement for your TPanel idea.
I removed caption bar of my window so now it only has a border around it. I don't want to set BorderStyle to bsNone but I want to remove border. How can I do it?
let me explain more. I want to make sth like Photoshop GUI. If I set border style to bsNone, I'll lose lots of features on win7. I tried to use GraphicControls instead of Form Caption bar to move the window (by handling WMNCHitTest message). It works but double click doesn't maximize and restore the window when border style is bsNone but everything works well when it is bsResizable. I want to set BorderStyle to bsResizable but I want to remove the border like when it is bsNone
You can set the form's border to bsNone and then add a panel to the form. Set the panel's align property to alClient and adjust its border however you like. You have control over the inner and outer bevels and their widths to a 1 pixel granularity. Since Panel1 is a container, it should be easy to just drag everything onto it as though it were the form itself. In the designer, it would be nearly invisible.
If you are not familiar with it, you can drag all the controls from one container to another using the structure view (it's called the object treeview in older versions). This makes it so you don't have to redesign your form to do this. If the panel itself is a problem, you can always just send it to the back and leave all the other controls on the form. It will look exactly the same, but then the controls maintain a TForm parent instead of a TPanel parent. It's just a little extra thing to maintain in the designer.
Having said that, I also recommend considering Mason's comment about nonstandard UIs.
Setting the borderstyle to "bsSizeToolWin" isn't an option? It would be a thinner border, but it would be resizeable and it's still conform the Windows standard...
I haven't seen latest Photoshop, but I guess you need something like that: http://delphihaven.wordpress.com/2010/04/22/setting-up-a-custom-title-bar-reprise/