Jump to content
TrickyWidget

Widget size always +1 of form snap grid size

Recommended Posts

Hi, folks.  I'm returning to Delphi after a looooong time away.  I just cranked up 10.3 (26.0.36039.7899) on Windows 10 and mostly it seems fine.  However, when I size my widgets with the snap grid on the form, they're always 1 too big on both axes.  For example, if I set the grid to 16x16 and make a button that is 2 spaces x 2 spaces, its size should be 32x32.  But instead, it's 33x33.  Or if I make it 6x3 spaces, its size is 97x49.  I've poked and tweaked everything I can think of, but they refuse to budge.  Every widget on every form is 1 too big!

 

Does anyone know what's going on or how to fix it?

 

Thanks!

 

EDIT:

This is about using the form designer in the IDE.  Here's an example with a 32x32 form snap grid.  All four corners of this button have been "snapped" to the grid.  It is 3 grid spaces wide and 2 grid spaces tall.  Its size should be 96x64.  But instead, it is 97x65.

 

TooBig.png.2f24b3f5ac3fd90badba06af8f935047.png

Edited by TrickyWidget

Share this post


Link to post
Guest

hi @TrickyWidget 

 

I dont know how you did your grid without see your code, but for easy adjustment for each content you can use a "GridPanel" and put your "containers" (...any other components like a Panel, Button, Edit, etc...") onto it.

Then, you can use the properties, like:  AlignWithMargins, Margins and Padding for accomodate it automatocally without any code. You see?

 

image.thumb.png.f5f3c42cdbba711efc903fa870376d50.png

 

hug

Share this post


Link to post

No code, just the snap-to grid that's on by default on each form.  The spacing is set in Tools > Options > Form Designer > Grid Options > Grid size/Snap tolerance.

Share this post


Link to post
Guest

hi @TrickyWidget

 

I dont remember have used some like this... can you give a script to reproduce it?

im curious about this... :classic_ninja:

 

would be some like this representation ? (blue lines)

image.png.1efc605455073fdca10042d680f74ebc.png   or   image.png.f99c7d7d3458c42c42e797aec5b7dd6e.png     image.thumb.png.ea5ff6c030e6e6fdbdcc178acb886ced.png

 

hug

Edited by Guest

Share this post


Link to post

Again, there's no script involved.  This is only using the IDE form designer.  Just make a new form and drop a button on it.  Then use the snap-grid to resize the button (or any other visible control) and check the size.  The control size should be an even multiple of the snap grid size.  But mine are always that +1.

Share this post


Link to post
Guest

I think that understood now... but look that the value stay on 2 and 128... not exist "1" look below

 

image.png.b7dc920a0d038d63097fc89d86ee30dd.png    size-value of Button2 is =  1    + 2  = 3     image.png.9696aeb1c5a035b27d00a99b430bd5df.png

 

hug

Edited by Guest

Share this post


Link to post

Just this.  I made the "Grid size/Snap tolerance" 32x32 so it's easy to see.  All four corners of this button have been "snapped" to the grid.  It is 3 grid spaces wide and 2 grid spaces tall.  Its size should be 96x64.  But instead, it is 97x65.

TooBig.png

Edited by TrickyWidget

Share this post


Link to post
Guest

1 should be because it's a "minimun size to a graphical element" on the screen... 1 (border visible in both side of component on screen - there is not "1/2 component" you see?) + 96 = 97.

 

hug

Edited by Guest

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×