Mattias Gaertner wrote:
On Wed, 15 Mar 2006 18:35:32 +0100
Bogus__aw Brandys <[EMAIL PROTECTED]> wrote:

Mattias Gaertner wrote:
On Wed, 15 Mar 2006 08:36:30 +0100
"Patrick Chevalley" <[EMAIL PROTECTED]> wrote:

Hi,


Even on my computer, that has a slightly bigger standard font on
Windows, most forms from the IDE look bad.

I also remark this problem with my application,  only with Windows big
font, all the testing I do with Gtk at different screen resolution do
not > show this problem.
I solve by calling this function after form.create :

scale := Screen.PixelsPerInch / myform.PixelsPerInch
*{$ifdef win32}*ScaleForm(myform,scale);*{$endif}*

*procedure* ScaleForm(form: TForm; scale: single);*
var* i: integer;*
begin*
*if* abs(1-scale)>0.1 *then*  // *do* *not* scale *for* 10%
*with* form *do* *begin*
   width := round( width * scale );
   height := round( height * scale );
   *for* i := 0 *to* ComponentCount-1 *do* *begin*
      *if* ( Components[i] is TControl ) *then* *with* (Components[i]
as TControl) *do* *begin*
         width := round( width * scale );
         height := round( height * scale );
         top := round( top * scale );
         left := round( left * scale );
      *end*;
   *end*;
*end*;
*end*;


Maybe this can be implemented in TCustomForm ? but this is outside of
my > competence.
If I remember Delphi as a TForm.Scaled property that do something like
that.
The scale only fixes resized fonts, but not other fonts, themes and
translations.
As Darius pointed out: we should improve the dialogs to use autosizing.


Mattias
Solution is to add sizers controls like in wxWidgets. Sizers are like non-visual panels which can grow or shrink on runtime in one or both directions with children aligned/scaled inside them.
I don't like them but I must confess that I don't see any better solution.

Please check wxWidgets documentation for details.

See BorderSpacing, ChildSizing, Align, AutoSize and Anchors property.
If you prefer to think in sizers, then use TPanel and set BevelOuter to
bvNone and BevelWidth to 0. What wxWidgets feature are you missing?


Mattias


When user will change screen resolution from 640x480 to 800x600 does Lazarus application still looks the same ? If the same project (from Windows) is compiled on Linux - does it look the same ? How about font scaling, how about box/flex-box sizers (kind of non visual grid which align child controls in cells) Besides sizers (as I know) in wxWidgets are non-visual (they are like set of rules) and do not took CPU time (they are not displayed at all)

P.S. I do not have much experience with sizers,but idea is looking interesting and I saw the same project under Windows and under Linux is different resolutions /font sizes - looks exactly the same and auto size on runtime (in higher resolution for example form/controls/fonts are a little bigger).Maybe we would consider sizers as additional non visual controls if it's possible (in Lazarus IDE it could be visually represented like panels/grid)

Regards
Bogusław

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to