Have you read and digested the Wiki article: Autosize/Layout (https://wiki.lazarus.freepascal.org/Autosize_/_Layout) ?
Starting in Lazarus 0.9.31 the LCL can reinterprete the LCL absolute layout in pixels as a flexible grid. There are multiple modes to choose from and they will allow to reinterprete the pixel values as either really absolute, or as in being adjusted for the DPI or as in being considered simply a fraction of the form size.
From the page, this looks relevant:QuoteStarting in Lazarus 0.9.31 the LCL can reinterprete the LCL absolute layout in pixels as a flexible grid. There are multiple modes to choose from and they will allow to reinterprete the pixel values as either really absolute, or as in being adjusted for the DPI or as in being considered simply a fraction of the form size.
I think scaling a form so that it is a constant fraction of the screen is the wrong way. Suppose a user with a super high-res screen with some thousands of pixels - he will be annoyed because most of his expensive monitor is covered by a super-blown-up form of some application. And then suppose a user with an 800 pixels screen who would be happy to increase the form to full resolution.
Anyway, I would like to point you to the torry site (https://torry.net) which contains the component TFormResizer (EasySize) which scales a form and all its controls in a uniform way. This was discussed in a thread of the German forum (https://www.lazarusforum.de/viewtopic.php?p=88001). I downloaded it, converted it to Lazarus, and wrote a small demo for it. In the demo the form is always scaled to cover 50% of the screen initially. The user can resize the form, and the form scales its contained controls proportionally. Note, however, that icons of bitbtns or themed parts of controls (checkboxes, radiobuttons) are not scaled (the embedded cheetah image does scale, on the other hand, because it is much larger than the displayed TImage control due to the Proportional property).
Last question though, how do you set float numbers when setting the screen (div) ?I don't understand. You want floats as screen coordinates? Not possible.
Last question though, how do you set float numbers when setting the screen (div) ?I don't understand. You want floats as screen coordinates? Not possible.
The division operator for floats is the slash:But when the result is expected to be an integer you must "round" (or "trunc", or "floor", or "ceil", depending on what is supposed to occur when the divison has a remainder):
var x: Double; ... x := 1023/2.4;
var x: Integer; ... x := round(1023/2.4);
Are you using "stretchdraw" to draw your background image? If not, then that may be the fix that you need.
Have a look at the attached image and project; it is a bit of a kludge, I have written a 'resize' event handler to "manually" adjust the position and size of the buttons. It would be much nicer to use align or similar to get the buttons to automatically resize but I couldn't work that out. I thought the TBevel component allowed an empty invisible "panel", but it requires the edge to be raised or lowered...
I couldn't work out how to draw on the tabsheet so I have added a TPaintBox component (aligned to client [the tabsheet]).
Despite all the above, I hope you find the project (at least somewhat) helpful. :)
cheers
S.
I think scaling a form so that it is a constant fraction of the screen is the wrong way. Suppose a user with a super high-res screen with some thousands of pixels - he will be annoyed because most of his expensive monitor is covered by a super-blown-up form of some application. And then suppose a user with an 800 pixels screen who would be happy to increase the form to full resolution.
Anyway, I would like to point you to the torry site (https://torry.net) which contains the component TFormResizer (EasySize) which scales a form and all its controls in a uniform way. This was discussed in a thread of the German forum (https://www.lazarusforum.de/viewtopic.php?p=88001). I downloaded it, converted it to Lazarus, and wrote a small demo for it. In the demo the form is always scaled to cover 50% of the screen initially. The user can resize the form, and the form scales its contained controls proportionally. Note, however, that icons of bitbtns or themed parts of controls (checkboxes, radiobuttons) are not scaled (the embedded cheetah image does scale, on the other hand, because it is much larger than the displayed TImage control due to the Proportional property).
Have a look at the TNotebook component. Handoko has mentioned it a number of times (I think) suggesting that it can be used without the tabs.
cheers
S.