Hello,
Thank you very much.
But i have a problem with the vertical position of the optiongadgets.
If i change this line:
Code: Alles auswählen
fs0 = *sizer\AddFramedSizer(s1, gdg0, #AWPB_GUILO_SIZER_HBOX | #AWPB_GUILO_SIZER_REL, 20)
by that line:
Code: Alles auswählen
;//***=========================CHANGE FOR VERTICAL DISPOSITION===================
fs0 = *sizer\AddFramedSizer(s1, gdg0, #AWPB_GUILO_SIZER_VBOX | #AWPB_GUILO_SIZER_REL, 20)
;//***===========================================================================
Optiongadgets are too spaced and never fit in the frame but if i change this code:
Code: Alles auswählen
;//***=========================CHANGE FOR VERTICAL DISPOSITION===================
fs0 = *sizer\AddFramedSizer(s1, gdg0, #AWPB_GUILO_SIZER_VBOX | #AWPB_GUILO_SIZER_REL, 20)
;//***===========================================================================
*sizer\AddGadget(fs0, #option_1, 30)
*sizer\AddGadget(fs0, #option_2, 30)
*sizer\AddGadget(fs0, #option_3, 30)
by that code:
Code: Alles auswählen
;//***=========================CHANGE FOR VERTICAL DISPOSITION===================
fs0 = *sizer\AddFramedSizer(s1, gdg0, #AWPB_GUILO_SIZER_VBOX | #AWPB_GUILO_SIZER_REL, 20)
;//***===========================================================================
*sizer\AddGadget(fs0, #option_1, 20)
*sizer\AddGadget(fs0, #option_2, 20)
*sizer\AddGadget(fs0, #option_3, 20)
it works very well.
But why 20 ?
résumé:
Code: Alles auswählen
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
IncludePath "..\include\awpbtools"
CompilerCase #PB_OS_Linux
IncludePath "../include/awpbtools"
CompilerEndSelect
XIncludeFile "awguilayout.pbi"
Enumeration
#option_1
#option_2
#option_3
EndEnumeration
Define win, gdg0, gdg1, gdg2, gdg3, gdg4, gdg5
Define *sizer.AWPB_GUILO_Sizer, s1.i, s2.i, s3.i
Define fs0.i, fs1.i, fs2.i, fs3.i, fs4.i, fs5.i
; you can change the font if you want
; If LoadFont(1, "Arial", 15)
; SetGadgetFont(#PB_Default, FontID(1))
; EndIf
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, 1, 1, "Frame 0 20% height, 100% width")
OptionGadget(#option_1, 0, 0, 1, 1, "Option 1")
OptionGadget(#option_2, 0, 0, 1, 1, "Option 2")
OptionGadget(#option_3, 0, 0, 1, 1, "Option 3")
SetGadgetState(#option_2, 1)
gdg1 = Frame3DGadget(#PB_Any, 0, 0, 1, 1, "Frame 1 - with borders a 10 px, 20% height, 100% width", #PB_Frame3D_Double)
gdg2 = Frame3DGadget(#PB_Any, 0, 0, 1, 1, "Frame 2 - 60% height, 50% width")
gdg3 = Frame3DGadget(#PB_Any, 0, 0, 1, 1, "Frame 3 - 30% height, 25% width", #PB_Frame3D_Double)
gdg4 = Frame3DGadget(#PB_Any, 0, 0, 1, 1, "Frame 4 - with borders a 5 px, 30% height, 25% width")
gdg5 = Frame3DGadget(#PB_Any, 0, 0, 1, 1, "Frame 5 - 60% height, 25% width")
s1 = *sizer\AddSizer(#Null, #AWPB_GUILO_SIZER_VBOX | #AWPB_GUILO_SIZER_REL, 100)
;//***=========================CHANGE FOR VERTICAL DISPOSITION===================
fs0 = *sizer\AddFramedSizer(s1, gdg0, #AWPB_GUILO_SIZER_VBOX | #AWPB_GUILO_SIZER_REL, 20)
;//***===========================================================================
; *sizer\AddGadget(fs0, #option_1, 30)
; *sizer\AddGadget(fs0, #option_2, 30)
; *sizer\AddGadget(fs0, #option_3, 30)
;
; It works better but why ?
*sizer\AddGadget(fs0, #option_1, 20)
*sizer\AddGadget(fs0, #option_2, 20)
*sizer\AddGadget(fs0, #option_3, 20)
fs1 = *sizer\AddFramedSizer(s1, gdg1, #AWPB_GUILO_SIZER_VBOX | #AWPB_GUILO_SIZER_REL, 20)
s2 = *sizer\AddSizer(s1, #AWPB_GUILO_SIZER_HBOX | #AWPB_GUILO_SIZER_REL, 60)
fs2 = *sizer\AddFramedSizer(s2, gdg2, #AWPB_GUILO_SIZER_VBOX | #AWPB_GUILO_SIZER_REL, 50)
s3 = *sizer\AddSizer(s2, #AWPB_GUILO_SIZER_VBOX | #AWPB_GUILO_SIZER_REL, 25)
fs3 = *sizer\AddFramedSizer(s3, gdg3, #AWPB_GUILO_SIZER_VBOX | #AWPB_GUILO_SIZER_REL, 50)
fs4 = *sizer\AddFramedSizer(s3, gdg4, #AWPB_GUILO_SIZER_VBOX | #AWPB_GUILO_SIZER_REL, 50)
fs5 = *sizer\AddFramedSizer(s2, gdg5, #AWPB_GUILO_SIZER_VBOX | #AWPB_GUILO_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
Furthermore, Examples 1 and 2 doesn't work anymore.
ex1
Code: Alles auswählen
;============================================================
; GUILOlayout_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"
Define win, gdg0, gdg1, gdg2, gdg3, gdg4, gdg5
Define *sizer.AWPB_GUILO_Sizer, s1.i, s2.i, s3.i
win = OpenWindow(#PB_Any, 542, 122, 410, 410, "GUILO-Layout-Demo", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
If IsWindow(win)
*sizer = AWPB_CreateSizerObj(win)
If *sizer
gdg0 = ButtonGadget(#PB_Any, 0, 0, 100, 10, "first Gadget - without borders, 20% height, 100% width", #PB_Button_MultiLine)
gdg1 = ButtonGadget(#PB_Any, 0, 0, 100, 10, "second Gadget - with borders a 10 px, 20% height, 100% width", #PB_Button_MultiLine)
gdg2 = ButtonGadget(#PB_Any, 0, 0, 100, 10, "third Gadget - without borders, 60% height, 50% width", #PB_Button_MultiLine)
gdg3 = ButtonGadget(#PB_Any, 0, 0, 100, 10, "fourth Gadget - without borders, 30% height, 25% width", #PB_Button_MultiLine)
gdg4 = ButtonGadget(#PB_Any, 0, 0, 100, 10, "fifth Gadget - with borders a 5 px, 30% height, 25% width", #PB_Button_MultiLine)
gdg5 = ButtonGadget(#PB_Any, 0, 0, 100, 10, "sixth Gadget - without borders, 60% height, 25% width", #PB_Button_MultiLine)
s1 = *sizer\AddSizer(#Null, #AWPB_GUILO_SIZER_VBOX|#AWPB_GUILO_SIZER_REL, 100)
*sizer\AddGadget(s1, gdg0, #AWPB_GUILO_SIZER_REL, 20)
*sizer\AddGadget(s1, gdg1, #AWPB_GUILO_SIZER_REL, 20, 10, 10, 10, 10)
s2 = *sizer\AddSizer(s1, #AWPB_GUILO_SIZER_HBOX|#AWPB_GUILO_SIZER_REL, 60)
*sizer\AddGadget(s2, gdg2, #AWPB_GUILO_SIZER_REL, 50)
s3 = *sizer\AddSizer(s2, #AWPB_GUILO_SIZER_VBOX|#AWPB_GUILO_SIZER_REL, 25)
*sizer\AddGadget(s3, gdg3, #AWPB_GUILO_SIZER_REL, 50)
*sizer\AddGadget(s3, gdg4, #AWPB_GUILO_SIZER_REL, 50, 5, 5, 5, 5)
*sizer\AddGadget(s2, gdg5, #AWPB_GUILO_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
ex2:
Code: Alles auswählen
; GUILOlayout_demo2.pb
; Version 0.1 [2011/07/27]
; 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"
Define win, con0, con1, spl0, gdg0, gdg1, gdg2, gdg3, gdg4
Define *sizerw.AWPB_GUILO_Sizer, *sizerl.AWPB_GUILO_Sizer, *sizerr.AWPB_GUILO_Sizer, s1.i, s2.i
win = OpenWindow(#PB_Any, 542, 122, 410, 410, "GUILO-Layout-Demo 2", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar)
If IsWindow(win)
con0 = ContainerGadget(#PB_Any, 0, 0, 100, 10, #PB_Container_Single)
gdg0 = ButtonGadget(#PB_Any, 0, 0, 100, 10, "first Gadget - 50% width of left side", #PB_Button_MultiLine)
gdg1 = ButtonGadget(#PB_Any, 0, 0, 100, 10, "second Gadget - 50% width of left side", #PB_Button_MultiLine)
CloseGadgetList()
con1 = ContainerGadget(#PB_Any, 0, 0, 100, 10, #PB_Container_Single)
gdg2 = ButtonGadget(#PB_Any, 0, 0, 100, 10, "third Gadget - 30% height of right side", #PB_Button_MultiLine)
gdg3 = ButtonGadget(#PB_Any, 0, 0, 100, 10, "fourth Gadget - 40% height of right side", #PB_Button_MultiLine)
gdg4 = ButtonGadget(#PB_Any, 0, 0, 100, 10, "fifth Gadget - 30% height of right side", #PB_Button_MultiLine)
CloseGadgetList()
spl0 = SplitterGadget(#PB_Any, 0, 1, 100, 10, con0, con1, #PB_Splitter_Separator|#PB_Splitter_Vertical)
*sizerw = AWPB_CreateSizerObj(win)
If *sizerw
*sizerl = AWPB_CreateSizerObj(con0)
If *sizerl
*sizerr = AWPB_CreateSizerObj(con1)
If *sizerr
*sizerw\AddGadget(#Null, spl0, #AWPB_GUILO_SIZER_REL, 100)
s1 = *sizerl\AddSizer(#Null, #AWPB_GUILO_SIZER_HBOX|#AWPB_GUILO_SIZER_REL, 100)
*sizerl\AddGadget(s1, gdg0, #AWPB_GUILO_SIZER_REL, 50)
*sizerl\AddGadget(s1, gdg1, #AWPB_GUILO_SIZER_REL, 50)
s2 = *sizerr\AddSizer(#Null, #AWPB_GUILO_SIZER_VBOX|#AWPB_GUILO_SIZER_REL, 100)
*sizerr\AddGadget(s2, gdg2, #AWPB_GUILO_SIZER_REL, 30)
*sizerr\AddGadget(s2, gdg3, #AWPB_GUILO_SIZER_REL, 40)
*sizerr\AddGadget(s2, gdg4, #AWPB_GUILO_SIZER_REL, 30)
*sizerw\Finish()
*sizerl\Finish()
*sizerr\Finish()
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case spl0
*sizerw\Resize()
*sizerl\Resize()
*sizerr\Resize()
EndSelect
Case #PB_Event_SizeWindow
*sizerw\Resize()
*sizerl\Resize()
*sizerr\Resize()
Case #PB_Event_CloseWindow
Select EventWindow()
Case win
CloseWindow(win)
win = 0
Break
EndSelect
EndSelect
ForEver
*sizerr\Destroy()
Else
MessageRequester("Fehler", "Konnte SizerR nicht erstellen")
EndIf
*sizerl\Destroy()
Else
MessageRequester("Fehler", "Konnte SizerL nicht erstellen")
EndIf
*sizerw\Destroy()
Else
MessageRequester("Fehler", "Konnte SizerW nicht erstellen")
EndIf
Else
MessageRequester("Fehler", "Konnte Fenster nicht erstellen")
EndIf
End
Thank you.
Mesa.