Page 1 of 1

Size Gadgets with a window {SORT Of SOLVED}

Posted: Tue Jul 26, 2011 1:18 pm
by Nexus100
Hi All

Thanks in advance!!!

I would like to know how to scale a gadget with a window.

That way if my app is run on different size desktops it will look correct...hopefully!!!

Also, is it possible to have shaped skinned buttons to make my app look a bit sexier!!

Cheers

Re: Size Gadgets with a window {SORT Of SOLVED}

Posted: Tue Jul 26, 2011 2:31 pm
by Nexus100
Just a little helper I found (Windows Only)

Code: Select all

RECT.rect
SystemParametersInfo_(#SPI_GETWORKAREA,0,@rect,0) 
debug rect\left
debug rect\right
debug rect\top
debug rect\bottom
This will give you the desktop "WORK" area - the area not hidden by the taskbar etc.

:mrgreen:

Re: Size Gadgets with a window {SORT Of SOLVED}

Posted: Tue Jul 26, 2011 3:03 pm
by Derren
What does Gadgetsize have to do with the size of the Desktop?

What you need is ResizeGadget()

Code: Select all

hWnd = OpenWindow(#PB_Any, 0, 0, 800, 600, "Fenster", #PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget)

StringGadget(0, 0, 0, WindowWidth(hWnd), 20, "StringGadget: 100% width")
StringGadget(1, 5, 25, WindowWidth(hWnd)-10, 20, "StringGadget: 100% width - 5px spacing")
ButtonGadget(2, 5, 50, WindowWidth(hWnd)/2 -10, WindowHeight(hWnd)-55, "ButtonGadget 50% width, 100% height - 55px - 5px spacing")
ButtonGadget(3, WindowWidth(hWnd)/2, 50, WindowWidth(hWnd)/2 -10, WindowHeight(hWnd)-55, "ButtonGadget 50% width, 100% height - 55px - 5px spacing")

Repeat
	event = WaitWindowEvent(20)
	Select event
		Case #PB_Event_SizeWindow 
			ResizeGadget(0, 0, 0, WindowWidth(hWnd), 20)
			ResizeGadget(1, 5, 25, WindowWidth(hWnd)-10, 20)
			ResizeGadget(2, 5, 50, WindowWidth(hWnd)/2 -10, WindowHeight(hWnd)-55)
			ResizeGadget(3, WindowWidth(hWnd)/2, 50, WindowWidth(hWnd)/2 -10, WindowHeight(hWnd)-55)
			
	EndSelect 
	
Until event = #PB_Event_CloseWindow
End

Re: Size Gadgets with a window {SORT Of SOLVED}

Posted: Tue Jul 26, 2011 5:09 pm
by Nexus100
Darren

Thanks for that...with regard to the desktop, I am coding on a NetBook and am fully aware that the desktop is smaller than that of a desk top of full laptop.

So i needed a way (using your code and gadget resize) to ensure that all fits onto the working area of the Desktop.

Thanks anyway!

Re: Size Gadgets with a window {SORT Of SOLVED}

Posted: Tue Jul 26, 2011 5:17 pm
by Derren
In that case use the Desktoplibrary.

Code: Select all

ExamineDesktops()
Debug "Width: "+ Str(DesktopWidth(0))
Debug "Height: "+ Str(DesktopHeight(0))