Re: LayoutManager, automatische Anordnung von Gadgets, Layou
Verfasst: 03.05.2012 18:48
Could you help me with this code please:
(a variant of one of yours)
I want to "layout" OptionGadgets inside a Frame3DGadget ?
I tried container but with no result.
Thank you.
Mesa.
(a variant of one of yours)
Code: Alles auswählen
;============================================================
; guilayout_demo.pb
; Version 0.1 [2011/07/26]
; Copyright (C) 2011 Ronny Krueger
;
; This file is part of AWPB-Tools.
;
; AWPB-Tools is free software: you can redistribute it and/or modify
; it under the terms of the GNU Lesser General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; AWPB-Tools is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU Lesser General Public License for more details.
;
; You should have received a copy of the GNU Lesser General Public License
; along with AWPB-Tools. If not, see <http://www.gnu.org/licenses/>.
EnableExplicit
XIncludeFile "awguilayout.pbi"
Enumeration
#option_1
#option_2
#option_3
EndEnumeration
Define win, gdg0, gdg1, gdg2, gdg3, gdg4, gdg5
Define *sizer.AWPB_GUI_Sizer, s1.i, s2.i, s3.i
win = OpenWindow(#PB_Any, 542, 122, 410, 410, "GUI-Layout-Demo", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
If IsWindow(win)
*sizer = AWPB_CreateSizerObj(win)
If *sizer
gdg0 = Frame3DGadget(#PB_Any, 0, 0, 100, 10, "Frame 0 20% height, 100% width")
OptionGadget(#option_1, 30, 20, 60, 20, "Option 1")
OptionGadget(#option_2, 30, 45, 60, 20, "Option 2")
OptionGadget(#option_3, 30, 70, 60, 20, "Option 3")
SetGadgetState(#option_2, 1)
gdg1 = Frame3DGadget(#PB_Any, 0, 0, 100, 10, "Frame 1 - with borders a 10 px, 20% height, 100% width")
gdg2 = Frame3DGadget(#PB_Any, 0, 0, 100, 10, "Frame 2 - 60% height, 50% width")
gdg3 = Frame3DGadget(#PB_Any, 0, 0, 100, 10, "Frame 3 - 30% height, 25% width")
gdg4 = Frame3DGadget(#PB_Any, 0, 0, 100, 10, "Frame 4 - with borders a 5 px, 30% height, 25% width")
gdg5 = Frame3DGadget(#PB_Any, 0, 0, 100, 10, "Frame 5 - 60% height, 25% width")
s1 = *sizer\AddSizer(#Null, #AWPB_GUI_SIZER_VBOX, #AWPB_GUI_SIZER_REL, 100)
*sizer\AddGadget(s1, gdg0, #AWPB_GUI_SIZER_REL, 20)
*sizer\AddGadget(s1, gdg1, #AWPB_GUI_SIZER_REL, 20, 10, 10, 10, 10)
s2 = *sizer\AddSizer(s1, #AWPB_GUI_SIZER_HBOX, #AWPB_GUI_SIZER_REL, 60)
*sizer\AddGadget(s2, gdg2, #AWPB_GUI_SIZER_REL, 50)
s3 = *sizer\AddSizer(s2, #AWPB_GUI_SIZER_VBOX, #AWPB_GUI_SIZER_REL, 25)
*sizer\AddGadget(s3, gdg3, #AWPB_GUI_SIZER_REL, 50)
*sizer\AddGadget(s3, gdg4, #AWPB_GUI_SIZER_REL, 50, 5, 5, 5, 5)
*sizer\AddGadget(s2, gdg5, #AWPB_GUI_SIZER_REL, 25)
*sizer\Finish()
Repeat
Select WaitWindowEvent()
Case #PB_Event_SizeWindow
*sizer\Resize()
Case #PB_Event_CloseWindow
Select EventWindow()
Case win
CloseWindow(win)
win = 0
Break
EndSelect
EndSelect
ForEver
*sizer\Destroy()
Else
MessageRequester("Fehler", "Konnte Sizer nicht erstellen")
EndIf
Else
MessageRequester("Fehler", "Konnte Fenster nicht erstellen")
EndIf
End
I tried container but with no result.

Thank you.
Mesa.