I tried it on x86 and x64 and it works.
Code: Select all
; Example ResizeGadget por Toni2013
;{
CompilerIf Not #PB_Compiler_IsIncludeFile
;- Window Constants
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
Enumeration
#Button_0
#ListIcon_0
EndEnumeration
CompilerEndIf
;}
Structure Ventana
Window.l
Gadget.l
Largo.w
Alto.w
Estado.i
Cleft.i
Cup.i
CRight.i
CDown.i
EndStructure
Global NewList Ventana.Ventana()
Procedure AutoResizeSet(Window.l, Gadget.l, Left.i, Up.i, Right.i, Down.i)
AddElement(Ventana())
Ventana()\Window = Window
Ventana()\Gadget = Gadget
Ventana()\Estado = 0
Ventana()\Largo = WindowWidth(Window)
Ventana()\Alto = WindowHeight(Window)
Ventana()\Cleft = Left
Ventana()\CUp = Up
Ventana()\CRight = Right
Ventana()\CDown = Down
EndProcedure
Procedure AutoResize(WindowID)
ForEach Ventana()
If WindowID=Ventana()\Window
Left=GadgetX(Ventana()\Gadget)
Up=GadgetY(Ventana()\Gadget)
La=GadgetWidth(Ventana()\Gadget)
Al=GadgetHeight(Ventana()\Gadget)
SepLeft=Ventana()\Largo-GadgetX(Ventana()\Gadget)
SepUp=Ventana()\Alto-GadgetY(Ventana()\Gadget)
SepRig=Ventana()\Largo-(GadgetX(Ventana()\Gadget)+La)
SepDow=Ventana()\Alto-(GadgetY(Ventana()\Gadget)+Al)
If Ventana()\CLeft=0
Left=WindowWidth(Ventana()\Window)-SepLeft
EndIf
If Ventana()\CUp=0
Up=WindowHeight(Ventana()\Window)-SepUp
EndIf
If Ventana()\CRight=1
La=WindowWidth(Ventana()\Window)-(Left+SepRig)
EndIf
If Ventana()\CDown=1
Al=WindowHeight(Ventana()\Window)-(Up+SepDow)
EndIf
ResizeGadget(Ventana()\Gadget,Left,Up,La,Al)
Ventana()\Largo=WindowWidth(Ventana()\Window)
Ventana()\Alto =WindowHeight(Ventana()\Window)
EndIf
Next
EndProcedure
CompilerIf Not #PB_Compiler_IsIncludeFile
Procedure Open_Window_0()
If OpenWindow(#Window_0, 220, 0, 600, 300, "AutoResize", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered )
ButtonGadget(#Button_0, 50, 5, 500, 30, "Wiki wiki")
ListIconGadget(#ListIcon_0, 55, 55, 530, 230, "Column0", 100)
AutoResizeSet(#Window_0,#Button_0,1,1,0,0)
AutoResizeSet(#Window_0,#ListIcon_0,1,1,1,1)
SetWindowColor(#window_0,0)
EndIf
EndProcedure
Open_Window_0()
Repeat
Event = WaitWindowEvent()
WindowID = EventWindow()
GadgetID = EventGadget()
EventType = EventType()
If Event = #PB_Event_Gadget
If GadgetID = #Button_0
ElseIf GadgetID = #ListIcon_0
EndIf
EndIf
If Event = #PB_Event_SizeWindow
AutoResize(WindowID)
EndIf
Until Event = #PB_Event_CloseWindow ; End of the event loop
End
CompilerEndIf