Page 1 of 1
IsGadgetList(#GadgetList) and CloseGadgetList(#GadgetList)
Posted: Wed Jan 20, 2010 9:46 am
by Kwai chang caine
Hi
If i create for example A containerGadget in an AreaGadget, it's possible to have several GadgetList one inside other like this :
Code: Select all
OpenWindow(#Window_0, 216, 0, 619, 279, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
ScrollAreaGadget(#ScrollArea_0, 21, 27, 581, 233, 1162, 466, 10)
ContainerGadget(#Container_0, 40, 41, 352, 138, #PB_Container_Raised)
If a = x
ScrollAreaGadget(#ScrollArea_1, 31, 19, 249, 96, 498, 192, 10)
EndIf
Code .....
Code .....
Code .....
Code .....
Code .....
If IsGadgetList(#ScrollArea_1)
CloseGadgetList(#ScrollArea_1)
EndIf
CloseGadgetList((#Container_0)
CloseGadgetList((#ScrollArea_0)
And it's difficult in this case to manage the CloseGadgetList()
There is nothing way to control if all the GadgetLists is closed and furthermore an over CloseGadgetList() crash the program
Good day
Re: IsGadgetList(#GadgetList) and CloseGadgetList(#GadgetList)
Posted: Wed Jan 20, 2010 10:35 am
by srod
I can't say as this has ever been a problem that I have encountered Kwai. It is just something you have to manage yourself and PB does force a measure of rigour upon proceedings in that there should be a CloseGadgetList() for each OpenGadgetList() etc. Your suggestion would simply encourage some 'sloppy' coding in my opinion, as is indeed the case with the kind of code you have posted above.
Re: IsGadgetList(#GadgetList) and CloseGadgetList(#GadgetList)
Posted: Wed Jan 20, 2010 6:19 pm
by Kwai chang caine
Ooohh!!!! my master
Forgive to your your floorcloth MASTER, i don't see your answer
Because i have fighted all the day with a bad menu

And obviously....no MASTER SROD at the skyline :roll:
Perhaps you are hidden behind a tree, and good hidden, because this time KCC don't find you
Fortunately the MASTER TROND have helped your servant
My MASTER wrote:Your suggestion would simply encourage some 'sloppy' coding in my opinion, as is indeed the case with the kind of code you have posted above.
Obviously, it's always the fault at your servant

And KCC always making cowpat code
If i have good understand, i must close and open and close.....for each element i add :roll:
Ok, ok...i make a deal with you.....but at the minimum, a empty IsGadgetList() can be usefull no ??? :roll:
Or perhaps, i have win a new medal of IDIOT today, with this new request

Re: IsGadgetList(#GadgetList) and CloseGadgetList(#GadgetList)
Posted: Wed Jan 20, 2010 6:39 pm
by Kaeru Gaman
each window element has a GadgetList.
you can say UseGadgetList( GadgetID( #Container ) ) to add sub-gadget to one specific gadget.
yes, it's your barn duty to KNOW wich bloody list you have opened and are writing into.
Re: IsGadgetList(#GadgetList) and CloseGadgetList(#GadgetList)
Posted: Wed Jan 20, 2010 9:54 pm
by srod
Kaeru Gaman wrote:...yes, it's your barn duty to KNOW wich bloody list you have opened and are writing into.

Re: IsGadgetList(#GadgetList) and CloseGadgetList(#GadgetList)
Posted: Thu Jan 21, 2010 12:10 pm
by Kwai chang caine
This story of GadgetList is not really simple, but for me like usually

Because everybody have understand..everybody exept one
http://www.purebasic.fr/english/memberl ... ile&u=2947
Me i believe that the GadgetList is only with Container or Area etc..
But apparently....i can create a GadgetList with not Gadget around :roll:
I have read the example of FRED, at the first see...it's logic...but after see more...
KCC ask to him : "Why is the real use of GadgetList alone, exept if the windows is #PB_Window_NoGadgets" :roll:
Never mind...perhaps a day KCC understand....it's like that perhaps a day it snowing in the desert
Code: Select all
If OpenWindow(0, 0, 0, 500, 500, "Fenêtre principale", #PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ButtonGadget(0, 10, 10, 150, 25, "Bouton 1")
; Creation d'une seconde fenêtre avec #PB_Window_NoGadgets pour empêcher la création automatique d'une GadgetList
If OpenWindow(1, 0, 0, 300, 200, "Fenêtre secondaire", #PB_Window_TitleBar|#PB_Window_WindowCentered|#PB_Window_NoGadgets, WindowID(0))
OldGadgetList = UseGadgetList(WindowID(1)) ; Creation d'une GadgetList et sauvegarde l'ancienne GadgetList
ButtonGadget(10, 10, 10, 150, 25, "Bouton Fenêtre secondaire") ; Ajoute ce bouton dans la nouvelle GadgetList(Fenêtre secondaire)
UseGadgetList(OldGadgetList) ; Retour à la GadgetList précédente
EndIf
ButtonGadget(1, 10, 45, 150, 25, "Bouton 2") ; Ce bouton sera sur la fenêtre principale
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf