Examineing PB Objects

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Examineing PB Objects

Post 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....
Tranquil
User avatar
hallodri
Enthusiast
Enthusiast
Posts: 208
Joined: Tue Nov 08, 2005 7:59 am
Location: Germany
Contact:

Post 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)
Tranquil
Addict
Addict
Posts: 952
Joined: Mon Apr 28, 2003 2:22 pm
Location: Europe

Post by Tranquil »

hey, this is cool and comes very handy. thanks for posting!
Tranquil
rsts
Addict
Addict
Posts: 2736
Joined: Wed Aug 24, 2005 8:39 am
Location: Southwest OH - USA

Post by rsts »

Very nice.

Thanks for sharing :)

cheers
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

Keep in mind it can be changed anytime, so don't base a real software on such tricks.
Post Reply