FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Explore Object's Properties and Methods
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Explore Object's Properties and Methods
Posted: Thu Jan 22, 2009 10:57 AM

Hi friends,

Is there any tool or utility available to browse the available properties and methods of a particular object. I always get struck at this point when ever I try to debug some objects

For eg:
ExploreObject(oXBrw)
ExPloreObject(oTGet)
ExPloreObject(oExcel:oSheet)

I understand that if it is a FiveWin object, there is atleast a chance to check the source code of the class, but what about other objects ?

Or any hint to get a start to develop one

Regards

Anser

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Explore Object's Properties and Methods
Posted: Fri Jan 23, 2009 07:26 AM
Anser,

You can use __ClassSel( oObject:ClassH ) to retrieve an array with all DATA and METHOD names.
If a name exists with an underscore at the beginning, then it is a DATA.

Here you have an example to retrieve all DATA names:
from FWH\source\function\odata.prg
function aOData( oObject )

   local aInfo  := ASort( __ClassSel( oObject:ClassH ) )
   local aData  := {}
   local n      := 1
   local lExact := Set( _SET_EXACT, .t. )

   while SubStr( aInfo[ n ], 1, 1 ) != "_"
      #ifdef __HARBOUR__ 
         if AScan( aInfo, "_" + aInfo[ n ], n + 1 ) != 0 
      #else 
         if AScan( aInfo, "_" + SubStr( aInfo[ n ], 1, 9 ), n + 1 ) != 0 
      #endif 
            AAdd( aData, aInfo[ n ] )
         endif
      n++
   end

   Set( _SET_EXACT, lExact )

return aData
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1335
Joined: Fri Jun 13, 2008 11:04 AM
Re: Explore Object's Properties and Methods
Posted: Fri Jan 23, 2009 08:06 AM

Mr.Antonio,

Thankyou for pointing me to the right direction and also for the code.

I am planning to make a Debugging utility function which will accept an object as a parameter. The utility will display all the properties and methods of that particular object in an xBrowse. If the object contains other objects as its properties/DATA, then the user can double click on it and explore its properties and so on.

Hope I am not re-inventing the wheel :D

Regards

Anser

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Explore Object's Properties and Methods
Posted: Fri Jan 23, 2009 08:33 AM

Anser,

Using the Harbour/xHarbour debugger you can inspect objects, same as we were able to do it with the Clipper debugger. The debugger is shown on a text console window.

Also you could review Andres Reyes GUI debugger to check if he has also implemented it:

http://www.fivetechsoft.com/files/utili ... ndebug.zip

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion