Page 1 of 1

Examineing PB Objects

Posted: Fri May 09, 2008 8:25 am
by Tranquil
Just a small idea/ whish:

As PB stores a lot of datas, related to PB objects, internaly, it would be nice if the coder can benefit from this. Maybe something like

PB-Windows:
ExaminePBWindows(), NextPBWindow(),GetPBWindowID()

PB-Gadgets:
ExaminePBGadget([WindowID]), NextPBGadget(), GetPBGadgetID()

This would help the coder not to add another list, to the existing internal one of pb, for handling with PB objects.

With this commands its then possible to save all Window-Position and sizes to an .ini file that can be loaded and restored on the next application start. No need for a new linked list to store these datas, deleting elements of that lists if an pb object got freed....

Posted: Fri May 09, 2008 8:43 am
by hallodri
try this :

Code: Select all

Import "ObjectManager.lib"
  PB_Object_EnumerateAll(obj,cb,uData)
  
  PB_Gadget_Objects.l
  PB_Window_Objects.l
EndImport 

Procedure GadgetEnumCB(id,*element,udata)
  
  Debug id
  
  ProcedureReturn #True ; if false then abort
EndProcedure


hwnd = OpenWindow(0,0,0,0,0,"")
OpenWindow(#PB_Any,0,0,0,0,"")
OpenWindow(55,0,0,0,0,"")

CreateGadgetList(hwnd)

ButtonGadget(0,0,0,0,0,"")
ButtonGadget(77,0,0,0,0,"")
StringGadget(2,0,0,0,0,"")
StringGadget(#PB_Any,0,0,0,0,"")



Debug "----------- Window -----------"
PB_Object_EnumerateAll(PB_Window_Objects,@GadgetEnumCB(),0)
Debug "----------- Gadget -----------"
PB_Object_EnumerateAll(PB_Gadget_Objects,@GadgetEnumCB(),0)

Posted: Fri May 09, 2008 4:43 pm
by Tranquil
hey, this is cool and comes very handy. thanks for posting!

Posted: Fri May 09, 2008 7:37 pm
by rsts
Very nice.

Thanks for sharing :)

cheers

Posted: Fri May 09, 2008 7:57 pm
by Fred
Keep in mind it can be changed anytime, so don't base a real software on such tricks.