April 26, 2024, 05:25:33 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Window vs. Dialog sizes

Started by LarryMc, August 22, 2012, 02:06:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

LarryMc

During the course of working on the new IDE's form designer I 'discovered' something I wasn't aware of.
(Maybe everyone else already knew this) ;)

First, we all know that the current IDE's dialog editor doesn't do windows; it's dialogs only.
And since we all normally use dialogs for popup windows in the center of the screen we don't concern ourselves with the actual overall dimensions of the dialog.  We just make it big enough to hold all the controls we need to display.
When we get everything to look like we want we just use what ever dimensions the editor gives us for the CREATEDIALOG command.

When I built IWB+ I started with windows and not dialogs, and I'm using some of the code from there in the new IDE.

With windows we basically start with a window size and then we adjust the client area of the window to subtract space used by captions and the various borders.

We can see this with windows by creating a window of a given size.
Then we use GETSIZE and we get the same dimensions we used in the OPENWINDOW command.
We then can use GETCILENTSIZE to get its dimensions.
The left-top is always zero.  The width and height will be the same as the w,h used when the window was created MINUS the space taken up by the caption and/or borders.
So the rule is that the container size is held constant and the client size is adjusted.

I had assumed dialogs work the same way. WRONG

After running some test I've discovered the following
If you create a dialog 400x300 with no @CAPTION and no @SIZE it creates a rectangle 401x301(i figure the difference just rounding error)
If you add a caption the created rectangle becomes 407x329
If you add @SIZE border it becomes 417x339
This means that the w,h values in the CREATEDIALOG command are not the container size of the dialog (as with windows) but is actually the client size.
So, the rule for dialogs is client size is held constant and the container size is adjusted.

My intention in the new IDE is to maintain these 2 rules.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

ZeroDog

You could always display both the client size and the dialog size in the dialog editor (status bar or something), so that people know how large both the client area and the dialog size would be.

LarryMc

Quote from: ZeroDog on August 23, 2012, 07:21:35 AM
You could always display both the client size and the dialog size in the dialog editor (status bar or something), so that people know how large both the client area and the dialog size would be.
That's the easy part. The time consuming part is getting the calculations correct so that what is seen in the design mode matches what is seen in the preview and what is seen when the generated code is compiled.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library