Few Windows window questions :)

Windows specific forum
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

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!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tranquil.
1) How do you find out the size of the desktop?
Use this:

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. :)

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?
I do this all in one Procedure using the ResizeGadget command.
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())
3) How do you find out things like size of the default font, title
bars and so forth?
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.

Hope that helps a bit.

bye

Mike

Tranquilizer/ Secretly!
Registred PureBasic User
Post Reply