Increase space / height between TListView items (and TTreeView items) on Windows larger items selection - delphi

I use Borland C++ Builder 2009 (yet I assume the issue and solution is the same for Delphi) and right now I assume the answer I'm looking for is the same for both TListView items and TTreeView items. I may be wrong !?
I have noticed, on a smaller Win 8.1 laptop with Display setting 'Change the size of all items' set to 125% . That the items in both TreeView and ListView get closer to each other.
I haven't tested 150% yet, I assume it will be worse.
I would like to adjust for that if possible.
I assume the same logic goes for when a larger sized font is chosen to display these items ?
How would you test if the height of the items is 'too' big and the items need a bit more space between them ?
And how would you increase the spacing between them ? Taking in account that my ListView implementation is virtual (ListView->OwnerData = true ;) !

TForm has Scaled property. If it is true, all components on a form should be resized automatically accordingly to font size. I cannot check right now if this works for TListView and TTreeView, but you should check this property anyway.

Related

Firemonkey TListView - Adjust item text margins

I'm implementing a TListView in a Firemonkey app, where the height of each list item must be as small as possible, just large enough to fit the text. However, there is an apparent margin on the top of the text, leaving an empty space at the beginning of each list item.
The item appearance is set to ListItemRightDetail, but I cannot find any properties anywhere to allow me to control this - neither in the FMX design or the Styles for the List View.
How do I eliminate the margin at the top of list item text so that I can minimize the list item heights?
There are not necessarily any "margin" properties, as this margin is pretty much built-in. However, this can be adjusted by modifying the PlaceOffset.Y property, and making them a negative value. This will "lift up" the contents within each list item. I find -3 to be a sufficient amount to reduce this margin...
ListView1.ItemAppearanceObjects.ItemObjects.Text.PlaceOffset.Y := -3;
ListView1.ItemAppearanceObjects.ItemObjects.Detail.PlaceOffset.Y := -3;

SpTBX: can I use Panels' DockedWidth/FloatingWidth

Moving from TBX to SpTBX. I used in the past TTbxDockablePanel which has such props:
DockedWidth
DockedHeight
FloatingWidth
FloatingHeight
I can't find such properties in SpTBX panels, so how should I change my code to use such props? ie. i need to get/set SpTBX panel's docked width/height and floating width/height.
DockedWidth and DockedHeight
A TSpTBXDockablePanel now has a property DefaultDockedSize. A docked panel is docked to either a vertical or horizontal dock, so it only needs one size, which specifies the width (in a vertical dock) or height (in a horizontal dock.) The length of the other axis is a result of either the dock size or the other panels in the same dock. If there are other panels, the size it becomes is the width of the other panels in the dock. If there aren't, it will use either the previous size (if DefaultDockedSize is 0) or try to use DefaultDockedSize.
See TSpTBXCustomDockablePanel.SetParent for the code. You'll be interested in the two branches beginning if ToDock then... and if ToFloating then.... There are some comments there that I've tried to interpret to write the above.
From memory, when I converted from TBX to SpTBX years ago, this was the hardest area to get behaving exactly the same. However, you can get it to behave 'okay', ie with behaviour that makes sense, easily.
FloatingWidth and FloatingHeight
Replaced by FloatingClientWidth and FloatingClientHeight. Note that these are the client sizes not window sizes, but in general they should be direct replacements.
In addition
There is a comment at the top of the SpTBXDkPanels.pas file,
// - To handle the size constraints use GetMinMaxSize when the DP is floating,
// and ConstrainedResize when is Docked (explicitly check if it's docked).
You might find that useful too.
There are a reasonable number of comments scattered through the code. The SpTBX library doesn't have very good documentation, but it does come with high-quality source... Use the source, Luke :)

Scrolling the TStringGrid pixel by pixel

Scrolling a TStringGrid using its horizontal scroll bar will scroll a column at a time. In some situations, this creates a really nasty behavior that makes the grid unusable: if the width of last column is large (example, 1000 pixels) the user won't be able to scroll the grid to see the entire content of the column.
There is a way to scroll by pixel? Or to set the correct scroll range for grid's scroll bar?
As far as I know, no you can't horizontally scroll the string or draw grids by pixels, only by whole columns. I agree it can be a problem by the way. I tend to autosize the columns but make the max initial size of any column be slightly less than the clientwidth of the control.
I have looked into the source code. With Borland's code it can't be done.
However, Lazarus has this capability.

Delphi: old QuickReport element size as autostretched or aligntobottom?

We have old QuickReport with Delphi 6 Professional.
We uses QRShape to make "table" (as in html, or Excel), not the frame (because the frame size is commonly different than shape, and in QRLabel/QRDBText we don't have spacing option...
So QRShape used as Rectangles (Cells) and Lines.
The main problem that when I have a Memo Field with AutoStretch option then I cannot set the Height of the Shape.
In these cases it would be good if I can set the shape to AutoStretched, or Aligned...
Have the QR some mechanism to set the Shape height as the parent Band's height dynamically?
Thanks for your help!
Regards: dd
The QuickReport suppor said:
Hi, we have added these features to the later versions of
QuickReport. I can't think of any way to do it with old QR. Regards,
Lut Mentz
Such a life... :-)
For anyone still interested in the solution to this, the component QRFrameLine does the job to change to the height of band

Delphi 7: Application scaling

On my notebook with a screen resolution of 1280x800 I've developed an application. Now I want to use it on a desktop computer with a resolution of 1600x1200.
Of course, it's too small on the desktop computer. I've set the sizes so that I could see the whole form on my notebook. But on the desktop computer, everything should be resized.
But on the large screen, things shouldn't be viewed bigger which means that the same amount of information can be displayed. Things should get a higher height and width value so that more information can be displayed.
In complicated code I mean something like this which should run automatically once when the form is created (OnCreate):
devResolutionX := 1280;
devResolutionY := 800;
useResolutionX := 1600; // how to get / read out this property?
useResolutionY := 1200; // how to get / read out this property?
Form1.Height := Form1.Height+devResolutionY-useResolutionY;
Form1.Height := Form1.Width+devResolutionX-useResolutionX;
// do that with all components which makes this approach complicated
What must I work with to reach that goal?
ScaleBy
alignments
anchors
Thank you very much in advance!
It looks like you just need to set the BorderStyle property of your form to bsSizeable. This will allow the user to resize the form (or maximize it) as he sees fit.
You will also want to make use of anchors here. If you set the akLeft, akTop, akRight, and akBottom anchors for all the components on your form, they will resize with the form.
As soon as you do this, though, you will probably quickly realize that wasn't actually what you wanted to do after all. These growing components are probably going to overlap with each other. So, you are going to need to put some thought into which edges of which components get anchored and which don't.
Sometimes you will need to do some more complicated component moving and sizing than can be handled by anchors alone. In these cases, you will want to handle the Form's OnResize event. This event will get fired whenever the user resizes the form, and it will give you the chance to do some math to recalulate the sizes and positions of certain components.
Just set your anchors correctly and the additional info will show. I wouldn't recommend programmatically forcing an arbitrary height and width. The best thing to do is use the form's OnClose event to save the form's height and width and then set the height and width with OnCreate.

Resources