I have a problem with a TForm who contain a TMemo. If Autosize is set to True on the TForm, my TForm is halved and then I can size it ...
That's exactly this problem : https://www.youtube.com/watch?v=3eG3kwRgPTo
I'm with Delphi 10.1 Berlin, all is ok with my Delphi XE6.
Did you know how I can fix it ?
Thanks
You have a kind of circular reference in that the child windows are resizing themselves to the parent and the parent resizing itself to the children, and none of them specifying a width. I agree it is odd that adding a TMemo seems to screw things up but like any circular reference it needs to be broken, so either you need to resize the screen programmatically or, as would probably be better in your case, simply size the panels and don't use the align properties of those. I have tried that approach and it works.
Of course this only allows the top or bottom panel to be made invisible - not those in the middle.
Related
I am using Delphi 2009 and I have set (of variable length) of records with the data <image, label, file path> and I would like to present those records in gallery-like structurei with the horizontal scroll of the entire list and, possibly, with no vertical scroll.
TDBCtrlGrid seems to be exact solution (I can keep records in the TClientDataSet and there is lot of automation in place), but is vertical-only collection (at least for Delphi 2009), it has Orientation property but (at least in design time) it controls the scrollbar only (places it in the bottom). So - maybe it is still possible to adapt TDBCtrlGrid for horizontal use?
TScrollBox (with TFrame child elements) is another promising solution, but so far I can achieve that all the frames are stacked vertically and I don't see how can I ask them to be side-be-side horizontally. So - is there way to use TScrollBox for horizonatl, gallery like structure?
I have reserved the option to use TcxDBVerticalGrid, but I am doing everything to avoid it - I am not sure about the capabilities of the complex grid to present images with its own image internal component, I prefer to use TImage or TDBImage component (seems to be robust) inside some container of controles (e.g. on TFrame and put those frames in TScrollBox).
Assuming the question is something like "How can I make TDBCtrlGrid work in horizontal mode?"
In addition to setting the orientation, you should also set RowCount and ColCount to some decent values.
I have a (Delphi bug?) that is annoying me for months: in one of my apps I have some controls (tedit, tbutton, etc) on a TPanel. Every time I close the project and reopen it I find the controls moved few pixels up. After 20-30 closings the controls are almost out of the panel so I have to drag them back. Anybody encountered such a problem? How to fix it?
I have Delphi XE.
Update:
Actually I have encountered this in two of my projects. Both involve controls on a TPanel.
If I compile the project the controls, in the exe, the controls are at the wrong position also.
I have a TEdit that is aligned to the top (of the TPanel) and its bottom is anchored to the bottom. The bottom will also 'forget' its correct position and move to the top.
Update:
Bug confirmed. It appears when the user changes the Bevel properties of the panel!
This issue is reported in Quality Central #106320 for Delphi XE2, in June 2012.
Its status is still 'need feedback', there is no sample project, but it looks as if has to do with descendant forms.
I suggest that once you have determined the exact location that you want the components to be in, you adjust their position in the FormCreate.
Then, in designmode you can just 'approximately' correct the position quickly, knowing that they will come out right at run-time.
Robs suggestions also sound worth a try.
BTW Should you manage to make a sample project, maybe others can then determine if it is fixed in later versions.
There is evidently some conflict between anchors and position, possibly involving form inheritance. I expect it has something to do with the order that various positioning constraints are applied in, as well as when the parent control's border size or margin gets updated. Besides, aligning to the top and anchoring the bottom sounds like a recipe for problems. Instead, consider clearing the alignment setting and anchoring the top and sides; it should give the same effect. Alternatively, put a spacing control (e.g., a TShape) aligned to the bottom of the panel, and then align the edit control to the client area, which should give the same effect as anchoring to the bottom.
Nonetheless, this should be easy to work around. In your form's OnCreate event handler, move your components to their correct positions by calling SetBounds on them. To stop further movement during the development cycle, you should probably clear the anchors, and then re-set them at run time.
It happened to me also in D7. I found that whenever I have open design time forms and change the resolution of desktop or minimize the IDE the bottom aligned controls are get pushed downwards, sometimes out of the form.
In order to prevent that kind of I use nowadays the same way HTML pages are designed.
Each of my forms have a layout that are divided with tPanels (like or tags used in html) tPanels are aligned according to their design.
Might not be the same problem but I think the solution I've found might work for you too.
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/
I'm using Delphi 2007 for Win32 and need to set the vertical scrollbar in TstringGrid to always be visible. How do you do that?
You can hide scrollbars with the Scrollbar property set to either ssNone, ssHorizontal, ssVertical, even when the number of rows and / or columns would normally make them appear.
You can however not force one or both scrollbars to be always visible but disabled, without creating a new descendent class and overriding methods. Unfortunately the standard grid controls have not evolved much since the days of Delphi 1, so your best bet is using some third party grid control instead. Preferably one that does also show proper proportional scroll thumbs.
There is a scrollbar property that can be set to ssNone, ssHorizontal, ssVertical or ssBoth.