Restored from previous forum. Originally posted by tinman.
Hi,
I have a few questions relating to application programming and things
to do with windows (actual windows, not the OS).
1) How do you find out the size of the desktop?
2) What strategy is best used for creating re-sizable GUIs? On the
Amiga, if the gui was resized, you'd get a message, free all the
gadgets and the recreate them taking the new window sizes into
account. Is this the same steps you need to do under Windows, or is
there a better way?
3) How do you find out things like size of the default font, title
bars and so forth?
Thanks!
Few Windows window questions :)
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by tranquil.
height=getsystemmetrics_(#SM_CYSCREEN)
width=getsystemmetrics_(#SM_CXSCREEN)
But next, please use the "Search"-function above, there is a topic about it in the Tips & Tricks Thread.
It looks something like:
Procedure SizeCallback(WindowID, Message, lParam, wParam)
Shared winw,winh
If Message = #WM_SIZE
;
winw = WindowWidth() : winh = WindowHeight()
If winw < 600 : winw = 602 : EndIf
If winh < 300 : winh = 303 : EndIf
;
ResizeGadget (0,0,0,winw-10,winh-70)
ResizeGadget ( 1, 4, 140, winw-20, winh-240)
ResizeGadget ( 2, 10, 10, winw-40, winh-310)
ResizeGadget ( 3, 10, winh-293, 100, 20)
UpdateStatusBar (0)
;
UpdateWindow_(WindowID())
EndIf
EndProcedure
SetWindowCallback(@SizeCallback())
Hope that helps a bit.
bye
Mike
Tranquilizer/ Secretly!
Registred PureBasic User
Use this:1) How do you find out the size of the desktop?
height=getsystemmetrics_(#SM_CYSCREEN)
width=getsystemmetrics_(#SM_CXSCREEN)
But next, please use the "Search"-function above, there is a topic about it in the Tips & Tricks Thread.
I do this all in one Procedure using the ResizeGadget command.
2) What strategy is best used for creating re-sizable GUIs? On the
Amiga, if the gui was resized, you'd get a message, free all the
gadgets and the recreate them taking the new window sizes into
account. Is this the same steps you need to do under Windows, or is
there a better way?
It looks something like:
Procedure SizeCallback(WindowID, Message, lParam, wParam)
Shared winw,winh
If Message = #WM_SIZE
;
winw = WindowWidth() : winh = WindowHeight()
If winw < 600 : winw = 602 : EndIf
If winh < 300 : winh = 303 : EndIf
;
ResizeGadget (0,0,0,winw-10,winh-70)
ResizeGadget ( 1, 4, 140, winw-20, winh-240)
ResizeGadget ( 2, 10, 10, winw-40, winh-310)
ResizeGadget ( 3, 10, winh-293, 100, 20)
UpdateStatusBar (0)
;
UpdateWindow_(WindowID())
EndIf
EndProcedure
SetWindowCallback(@SizeCallback())
No Idea yet, but should be possible to solve this with some API Commands. Please take a look into the Tips & Tricks Section, there you can find some Links to good API Reference Sources.3) How do you find out things like size of the default font, title
bars and so forth?
Hope that helps a bit.
bye
Mike
Tranquilizer/ Secretly!
Registred PureBasic User