Code: Alles auswählen
If IsWindow(#TileSetWindow)
If WindowEvent()=#PB_Event_SizeWindow
ResizeGadget(#TileSetWindow_Gadget_ScrollArea,0,0,WindowWidth(#TileSetWindow),WindowHeight(#TileSetWindow))
EndIf
EndIf
Code: Alles auswählen
If IsWindow(#TileSetWindow)
If WindowEvent()=#PB_Event_SizeWindow
ResizeGadget(#TileSetWindow_Gadget_ScrollArea,0,0,WindowWidth(#TileSetWindow),WindowHeight(#TileSetWindow))
EndIf
EndIf
innerhalb Deiner Eventschleife WindowEvent() noch einmal abzufragen istSebastian hat geschrieben:Code: Alles auswählen
If IsWindow(#TileSetWindow) If WindowEvent()=#PB_Event_SizeWindow ; !!! TADAAA ResizeGadget(#TileSetWindow_Gadget_ScrollArea,0,0,WindowWidth(#TileSetWindow),WindowHeight(#TileSetWindow)) EndIf EndIf
Code: Alles auswählen
Procedure ResizeCallback(hWnd,Msg,wParam,lParam)
Result = #PB_ProcessPureBasicEvents
If Msg = #WM_SIZE
w = lParam & $FFFF
h = (lParam >> 16 ) & $FFFF
Select hWnd
Case WindowID(0)
MoveWindow_(GadgetID(0),0,0,w,h,1)
EndSelect
EndIf
ProcedureReturn Result
EndProcedure
OpenWindow(0,0,0,500,300,"PB_Scrollbar",#PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
CreateGadgetList(WindowID(0))
ScrollAreaGadget(0,0,0,WindowWidth(0),WindowHeight(0),500,500,10,#PB_ScrollArea_Single)
CloseGadgetList()
SetWindowCallback(@ResizeCallback())
Repeat
Event.l = WaitWindowEvent():
Until Event = 16
End
Code: Alles auswählen
OpenWindow(0, 0, 0, 320, 180, "Autosize", #PB_Window_ScreenCentered|#PB_Window_SizeGadget|#PB_Window_SystemMenu)
SmartWindowRefresh(0, 1) ;Damit verhinderst du das Flackern beim vergrößern
CreateGadgetList(WindowID(0))
ButtonGadget(0, 0, 0, 320, 180, "Ich vergrößere mich automatisch ;-)")
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_SizeWindow
ResizeGadget(0, 0, 0, WindowWidth(0), WindowHeight(0))
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
If EventGadget() = 0
Break
EndIf
EndSelect
ForEver
End