LB Booster
« Size of graphics box? »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:20am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Size of graphics box?  (Read 473 times)
Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Size of graphics box?
« Thread started on: Jul 10th, 2015, 1:49pm »

Hi again

I am opening a window with the following command:

open "Window" for dialog as #main

I am setting the size with the WindowWidth & WindowHeight variables.

I am also setting a graphics box to the same size using:

graphicbox #main.gfx, 0, 0, WindowWidth, WindowHeight

Does that mean that the displayed graphics box will actually be slightly smaller than WindowWidth & WindowHeight because they include the window borders as well? Do I need to use something like:

graphicbox #main.gfx, 0, 0, WindowWidth-6, WindowHeight-6

to fit the graphics box inside the window frame?
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Size of graphics box?
« Reply #1 on: Jul 10th, 2015, 3:54pm »

on Jul 10th, 2015, 1:49pm, Monkfish wrote:
I am also setting a graphics box to the same size

Not answering your question, but why are you filling an entire dialog window with a graphicbox? The only thing I can immediately think of is that perhaps you are sometimes hiding the graphicbox to reveal the dialog behind. If it's not that, what do you achieve that opening a simple graphics window doesn't:

Code:
open "Window" for graphics as #main 

But to get back to the question, one of the weaknesses of LB (which is not addressed in LBB) is that WindowWidth and WindowHeight control not the size of the client area, which would almost certainly be more useful, but the size of the entire window (including the 'non-client' furniture).

This can be quite a problem, not least because the thickness of the borders and title bar can depend on the version of Windows and the currently-selected theme, so precise positioning and sizing of windows/controls becomes virtually impossible if you want it to work across a range of different platforms.

Things are made even worse if you use the RESIZEHANDLER command because then WindowWidth and WindowHeight are perversely set to the client dimensions of the window!

Quote:
Do I need to use something like:
graphicbox #main.gfx, 0, 0, WindowWidth-6, WindowHeight-6
to fit the graphics box inside the window frame?

If you want it to work 'properly' in all circumstances I would recommend using an API call (GetClientRect) to discover the size of the 'container' window's client area and then use LOCATE to change the size of the graphicbox to suit.

Richard.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Size of graphics box?
« Reply #2 on: Jul 15th, 2015, 1:16pm »

Quote:
But to get back to the question, one of the weaknesses of LB (which is not addressed in LBB) is that WindowWidth and WindowHeight control not the size of the client area, which would almost certainly be more useful, but the size of the entire window (including the 'non-client' furniture).


Thanks Richard. That answers my question. I have also now discovered that the height of the entire window is different under XP and later versions of Windows, which is a bit annoying. Doesn't really matter in my case.

BTW, I wasn't actually filling the entire window with a graphics box, I was leaving room at the top for some buttons. I omitted this small fact as it wasn't relevant to my question. smiley

Thanks again smiley
smiley smiley
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Size of graphics box?
« Reply #3 on: Jul 15th, 2015, 3:59pm »

on Jul 15th, 2015, 1:16pm, Monkfish wrote:
BTW, I wasn't actually filling the entire window with a graphics box, I was leaving room at the top for some buttons.

You can still use open "" for graphics... since it's legitimate to put buttons and other child controls on a graphics window (unofficially in LB 4.04, although it seems to work, but officially in LBB).

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls