ResizeGadget Based on Window Size

Share your advanced PureBasic knowledge/code with the community.
michaeled314
Enthusiast
Enthusiast
Posts: 340
Joined: Tue Apr 24, 2007 11:14 pm

ResizeGadget Based on Window Size

Post by michaeled314 »

Code: Select all

Procedure.l Callback(Window,Message,wParam,lParam)
 Result = #PB_ProcessPureBasicEvents
 Select Message
  Case #WM_SIZE
   GetClientRect_(Window,innerarea.RECT)
   ResizeGadget(0,20,20,innerarea\right-20,innerarea\bottom-20)
   Result = 0
 EndSelect
 ProcedureReturn Result
EndProcedure

If OpenWindow(0,0,0,500,500,"Test",#PB_Window_ScreenCentered|#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget|#PB_Window_SizeGadget)
 hwnd = WindowID(0)
 If CreateGadgetList(WindowID(0))
  WebGadget(0,20,20,460,460,"http://www.yahoo.com/")
 EndIf
 SetWindowCallback(@Callback(),0)
 Repeat
  Event = WindowEvent()
 Until Event = #PB_Event_CloseWindow
EndIf
milan1612
Addict
Addict
Posts: 894
Joined: Thu Apr 05, 2007 12:15 am
Location: Nuremberg, Germany
Contact:

Post by milan1612 »

I'd recommend you to take a look at srod's nxTools.
It's much easier when you have to take care on multiple gadgets.
Windows 7 & PureBasic 4.4
Post Reply