resizing gadget when resizing window?

Just starting out? Need help? Post your questions and find answers here.
muab256
User
User
Posts: 43
Joined: Mon Apr 28, 2003 4:57 pm

resizing gadget when resizing window?

Post by muab256 »

hiho =))

how would i have to change this code to work properly?

Case #PB_event_resizewindow
ResizeGadget(4, 6, 10, WindowWidth()-12, WindowHeight()-20)

thx
muaB
Henrik
Enthusiast
Enthusiast
Posts: 404
Joined: Sat Apr 26, 2003 5:08 pm
Location: Denmark

Post by Henrik »

Hi muab256

i would use the SetWindowCallback function for stuff like that but, but -"i'm no guro sooo"-
Anyway as i recall there is a functional example of that, in your Examples [dir]
The "WebBrowser.pb" uses SetWindowCallback(@SizeCallback()) and the
Procedure ResizeWebWindow()

Take look at that one.

and i recalled right, i'm old but not that old :?


Bedst Regards
Henrik
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Post by Danilo »

For completeness sake, a small example:

Code: Select all

Procedure WinCallback(Win,Msg,wParam,lParam)
  Select Msg
    Case #WM_SIZE
      ResizeGadget(1,5,5,WindowWidth()-10,WindowHeight()-10)
  EndSelect
  ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure

OpenWindow(0,0,0,200,30,#PB_Window_ScreenCentered|#PB_Window_SystemMenu|#PB_Window_SizeGadget,"Test")
  CreateGadgetList(WindowID())
  ButtonGadget(1,5,5,190,20,"Button")
  
SetWindowCallback(@WinCallback())

Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
cya,
...Danilo
...:-=< http://codedan.net/work >=-:...
-= FaceBook.com/DaniloKrahn =-
Post Reply