Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-01

Shrink-fitting a form around its content

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

If I have something like a frame containing a wizard-style notebook, or for that matter something like a DB-aware grid tailored to its content, is there a portable way to fit a form or some other container around it?

The problem seems to be that each OS or widget set has a different amount of "furniture" between its declared dimensions and its client space.

The particular case that I'm thinking of is a modal form I've knocked together to get database login information. This is a notebook which allows the server, port number, SSL mode, schema/table identifier etc. to be collected, as well as the standard username and password. But it would also be useful to be able to embed two of these into something (i.e. one for a local database and one for an upstream one), which suggests that redoing it as a frame would be a worthwhile approach /provided/ that a container could be fitted trivially around it without having to maintain conditional "fudge factors".

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Avishai
to Mark Morgan Lloyd

You may be looking for TForm.AutoSize, TPanel.AutoSize...

On Mon, Jan 21, 2013 at 9:19 PM, Mark Morgan Lloyd <

Show quoted text 31 lines
wrote: If I have something like a frame containing a wizard-style notebook, or for that matter something like a DB-aware grid tailored to its content, is there a portable way to fit a form or some other container around it? The problem seems to be that each OS or widget set has a different amount of "furniture" between its declared dimensions and its client space. The particular case that I'm thinking of is a modal form I've knocked together to get database login information. This is a notebook which allows the server, port number, SSL mode, schema/table identifier etc. to be collected, as well as the standard username and password. But it would also be useful to be able to embed two of these into something (i.e. one for a local database and one for an upstream one), which suggests that redoing it as a frame would be a worthwhile approach /provided/ that a container could be fitted trivially around it without having to maintain conditional "fudge factors". -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues] -- ______________________________**_________________ Lazarus mailing list .**freepascal.org http://lists.lazarus.**freepascal.org/mailman/**listinfo/lazarus<http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus>
Shalom, Avishai ????? ???? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130121/f65f61dd/attachment.html>

Reply by email

Mattias Gaertner
to Mark Morgan Lloyd: If I have something like a frame containing a wizard-style notebook, or for that matter…
If I have something like a frame containing a wizard-style notebook, or for that matter something like a DB-aware grid tailored to its content, is there a portable way to fit a form or some other container around it?

Put frame on a form and set the form's AutoSize to true.

The problem seems to be that each OS or widget set has a different amount of "furniture" between its declared dimensions and its client space.

Note: A TFrame does not have any furniture. Window size is Client size on all platforms.

Show quoted text 9 lines
The particular case that I'm thinking of is a modal form I've knocked together to get database login information. This is a notebook which allows the server, port number, SSL mode, schema/table identifier etc. to be collected, as well as the standard username and password. But it would also be useful to be able to embed two of these into something (i.e. one for a local database and one for an upstream one), which suggests that redoing it as a frame would be a worthwhile approach /provided/ that a container could be fitted trivially around it without having to maintain conditional "fudge factors".

Mattias

Reply by email

Mark Morgan Lloyd
to Mattias Gaertner
Mattias Gaertner wrote 8 lines
On Mon, 21 Jan 2013 19:19:24 +0000 Mark Morgan Lloyd wrote: > If I have something like a frame containing a wizard-style notebook, or > for that matter something like a DB-aware grid tailored to its content, > is there a portable way to fit a form or some other container around it? Put frame on a form and set the form's AutoSize to true.

Thanks, I'll experiment. Is that specifically a form property or is it possible to do the same for e.g. a page control or a panel?

Show quoted text 5 lines
> The problem seems to be that each OS or widget set has a different > amount of "furniture" between its declared dimensions and its client space. Note: A TFrame does not have any furniture. Window size is Client size on all platforms.

In the case of a TFrame, yes. But I was thinking of the form case where there are- if my experience is reliable- significant differences between the Windows and X way of doing things.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mattias Gaertner
to Mark Morgan Lloyd
Show quoted text 12 lines
Mattias Gaertner wrote: > On Mon, 21 Jan 2013 19:19:24 +0000 > Mark Morgan Lloyd wrote: > >> If I have something like a frame containing a wizard-style notebook, or >> for that matter something like a DB-aware grid tailored to its content, >> is there a portable way to fit a form or some other container around it? > > Put frame on a form and set the form's AutoSize to true. Thanks, I'll experiment. Is that specifically a form property or is it possible to do the same for e.g. a page control or a panel?

TPanel, yes.
TPageControl, no.

Show quoted text 9 lines
>> The problem seems to be that each OS or widget set has a different >> amount of "furniture" between its declared dimensions and its client space. > > Note: A TFrame does not have any furniture. Window size is Client size > on all platforms. In the case of a TFrame, yes. But I was thinking of the form case where there are- if my experience is reliable- significant differences between the Windows and X way of doing things.

Yes. I guess there are still some window managers, where form.autosize does not work well.
But the other way round - autosizing the content - works always.

Mattias

Reply by email

Mark Morgan Lloyd
to Mattias Gaertner
Mattias Gaertner wrote 16 lines
On Mon, 21 Jan 2013 20:49:25 +0000 Mark Morgan Lloyd wrote: > Mattias Gaertner wrote: >> On Mon, 21 Jan 2013 19:19:24 +0000 >> Mark Morgan Lloyd wrote: >> >>> If I have something like a frame containing a wizard-style notebook, or >>> for that matter something like a DB-aware grid tailored to its content, >>> is there a portable way to fit a form or some other container around it? >> Put frame on a form and set the form's AutoSize to true. > Thanks, I'll experiment. Is that specifically a form property or is it > possible to do the same for e.g. a page control or a panel? TPanel, yes. TPageControl, no.

Thanks. Panel and form are probably the major cases. [Pokes IDE] I suppose the length of a bevel as well but I presume that everything reasonable can be handled by alignment.

Show quoted text 11 lines
>>> The problem seems to be that each OS or widget set has a different >>> amount of "furniture" between its declared dimensions and its client space. >> Note: A TFrame does not have any furniture. Window size is Client size >> on all platforms. > In the case of a TFrame, yes. But I was thinking of the form case where > there are- if my experience is reliable- significant differences between > the Windows and X way of doing things. Yes. I guess there are still some window managers, where form.autosize does not work well. But the other way round - autosizing the content - works always.

Yes, that I'm used to. But I've asked about "shrink-fitting" a form a couple of times over the last two or three years without a definite response- presumably the implementation's improving.

If it works well with gtk and adequately with Windows I'll be entirely happy.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Hans-Peter Diettrich
to Mark Morgan Lloyd: Thanks, I'll experiment. Is that specifically a form property or is it possible to do the…
Show quoted text 6 lines
> Note: A TFrame does not have any furniture. Window size is Client size > on all platforms. In the case of a TFrame, yes. But I was thinking of the form case where there are- if my experience is reliable- significant differences between the Windows and X way of doing things.

The NC (non-client) parts of a form vary with every OS, widgetset, themes and other factors (auto-scrollbars...). When you turn of all automatisms, the NC area can be computed from the form Bounds and ClientRect area - provided that Lazarus does support that difference for forms now.

DoDi

Reply by email