Author |
Topic: Size of graphics box? (Read 473 times) |
|
Monkfish
Full Member
member is offline
Gender:
Posts: 104
|
|
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?
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
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.
|
|
Logged
|
|
|
|
Monkfish
Full Member
member is offline
Gender:
Posts: 104
|
|
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.
Thanks again
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline
Posts: 1348
|
|
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.
|
|
Logged
|
|
|
|
|