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.
Related
I created my form and it looks fine in the standard size when ran with the program, however when I maximize the form, the components get messed up. I anchored the components on the left and right, however a giant gap is created in the middle of the form and I don't know how to fix it. When in the 'Design' view of the program, all my components are touching from me trying to fill the middle gap. I tried aligning, anchoring and searched online for a while with no luck. Any clue?
Form in standard size upon running program:
Form in full screen with giant middle gap:
From the form's OnResize event, you can compute the width and left property values for the component to fit the new size. You can adjust the width of components or distribute the distance between components to get the look you want. Or a combination of the two.
It is also possible to put the components on two lines if the form's width becomes too small. Or use a scroll panel so that the user can scroll to see what is not possible to show correctly given the width.
All that requires coding. Parts can be done using panels and align the panels.
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 am trying to use the latest Vaadin Designer (v8) to layout a bunch of controls in an absolute layout. I also have a horizontal layout that is on the same layout.
My problem is I just want to move a label to an absolute x,y position within absolute layout. I know I can achieve this by hand or by nudging the label to the x,y I want with the arrow keys. When I try to drag it onto the layout however this happens.
Perhaps there is no way to do this. I was thinking there should be a feature like holding down alt-key while dragging keeps the control within its current layout?
You are completely right. You can achieve it by using arrow key or Position property (if you are in an AbsoluteLayout) but currently, there is no way to do that by dragging the components.
Whenever you drag some components over a layout, it will be always hooked into that layout.
Your suggestion about using ALT-key to avoid this problem is very nice. The team would very much appreciate if you can fill in an issue (https://github.com/vaadin/designer/issues/new) as a feature request/improvement which we can consider later on.
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.
By default WP7 buttons are surrounded by a black space of 5ish pixels. I'd like to remove this, but I've tried setting the Margin, BorderThickness, Padding properties to be a Thinkness of zero, but this seems to have no effect on this mysterious space. Any clues what exactly this spaces is and how I might get rid of it.
Thanks,
Robert
This border is specifically added to increase the size of the button as a touch target. Having this padding makes it easier for people to be sure that they are touching the control they are aiming for.
If you are trying to remove this to fit more controls on the page be aware you're probably making it easier for users to accidentally tap the wrong control.
If you really must do this you must retemplate the button control.
The only difference you need to make to the default template (you can get a copy of this from Blend) is to change the margin on the controller from
<Border ... Margin="{StaticResource PhoneTouchTargetOverhang}">
to whatever value is appropriate for you.
Please also note that by changing this value you're likely to create issues for yourself when smaller screen devices are introduced.