Author |
Topic: Should REFRESH update WindowWidth/Height? (Read 320 times) |
|
RobM
Junior Member
member is offline


Posts: 91
|
 |
Re: Should REFRESH update WindowWidth/Height?
« Reply #3 on: Aug 11th, 2017, 9:02pm » |
|
Not sure what the answer is. "resize.bas" that ships with LB doesn't work properly so it would seem Carl struggled with how it should work. An LBB directive that can change how it works might be the best way to go.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Should REFRESH update WindowWidth/Height?
« Reply #4 on: Aug 11th, 2017, 9:24pm » |
|
on Aug 11th, 2017, 9:02pm, RobM wrote:| "resize.bas" that ships with LB doesn't work properly. |
|
It works "properly" after the window is manually resized, doesn't it? It's only the initial state that is wrong, and that's precisely Rod's point: if there was some easy way of getting the client dimensions into WindowWidth and WindowHeight without having to manually resize the window it would fix that issue. Here it's done using an API call to prove the point:
Code: nomainwin
WindowWidth = 550
WindowHeight = 410
listbox #resizer.lbox1, array$(), [lbox1DClick], 1, 0, 256, 186
listbox #resizer.lbox2, array$(), [lbox2DClick], 257, 0, 284, 164
combobox #resizer.cbox3, array$(), [cbox3DoubleClick], 257, 164, 283, 150
texteditor #resizer.tedit4, 1, 186, 540, 195
open "Resizing example" for window as #resizer
#resizer "trapclose [quit]"
#resizer "resizehandler [resized]"
' Rod would like to replace this block of code with #resizer "refresh":
hw = hwnd(#resizer)
struct rect, left as long, top as long, right as long, bottom as long
calldll #user32, "GetClientRect", hw as ulong, rect as struct, r as void
WindowWidth = rect.right.struct
WindowHeight = rect.bottom.struct
[resized]
wWid = WindowWidth
wHig = WindowHeight
upperVert = int(256/550*wWid) 'upper middle vertical edge
midHoriz = int(186/410*wHig) 'middle horizontal edge
urWid = upperVert - wWid
#resizer.lbox1 "locate 0 0 "; upperVert; " "; int(186/410*wHig)
#resizer.lbox2 "locate "; upperVert; " 0 "; wWid-upperVert; " "; int(186/410*wHig)-23
#resizer.cbox3 "locate "; upperVert; " "; midHoriz-23; " "; wWid - upperVert; " "; 100
#resizer.tedit4 "!locate 0 "; midHoriz; " "; wWid; " "; wHig-midHoriz;
#resizer "refresh"
wait
[quit] 'quit the program
close #resizer
end Richard.
|
|
|
|
RobM
Junior Member
member is offline


Posts: 91
|
 |
Re: Should REFRESH update WindowWidth/Height?
« Reply #5 on: Aug 11th, 2017, 9:35pm » |
|
Correct, I was referring to the initial state.
|
|
Logged
|
|
|
|
Richard Russell
Administrator
member is offline


Posts: 1348
|
 |
Re: Should REFRESH update WindowWidth/Height?
« Reply #6 on: Aug 12th, 2017, 09:38am » |
|
on Aug 11th, 2017, 9:02pm, RobM wrote:| it would seem Carl struggled with how it should work. |
|
I can only assume that he wasn't/isn't familiar with the AdjustWindowRect API, the use of which would have made it very easy for WindowWidth and WindowHeight to refer always to the client area, solving this and other problems.
As Raymond Chen frequently says in his Microsoft blog, a time machine would be very helpful!
Richard.
|
|
Logged
|
|
|
|
|