Size Gadgets with a window {SORT Of SOLVED}

Just starting out? Need help? Post your questions and find answers here.
User avatar
Nexus100
User
User
Posts: 55
Joined: Tue Feb 16, 2010 9:40 pm
Location: Essex, UK

Size Gadgets with a window {SORT Of SOLVED}

Post 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
All watched over by MACHINES..I am little more than #DigitalPlankton
User avatar
Nexus100
User
User
Posts: 55
Joined: Tue Feb 16, 2010 9:40 pm
Location: Essex, UK

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

Post 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:
All watched over by MACHINES..I am little more than #DigitalPlankton
User avatar
Derren
Enthusiast
Enthusiast
Posts: 318
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

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

Post 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
User avatar
Nexus100
User
User
Posts: 55
Joined: Tue Feb 16, 2010 9:40 pm
Location: Essex, UK

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

Post 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!
All watched over by MACHINES..I am little more than #DigitalPlankton
User avatar
Derren
Enthusiast
Enthusiast
Posts: 318
Joined: Sat Jul 23, 2011 1:13 am
Location: Germany

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

Post by Derren »

In that case use the Desktoplibrary.

Code: Select all

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