LISTING 1: VARIABLE LIST

Classdefinition lcd_Window
Long ll_Handle, ll_Counter, ll_Max

lcd_Window=FindClassDefinition(This.ClassName())
ll_Handle=tv_1.InsertItemLast(0,lcd_Window.Name,1)
ll_Max=UpperBound(lcd_Window.VariableList)
FOR ll_Counter=1 TO ll_Max
   tv_1.InsertItemLast(ll_Handle, &
   lcd_Window.VariableList [ll_Counter].Name,1)
NEXT

LISTING 2: NESTED CLASSES

Classdefinition	lcd_Window
Long		ll_Handle, ll_Counter, ll_Max

lcd_Window=FindClassDefinition(This.ClassName())
ll_Handle=tv_1.InsertItemLast(0,lcd_Window.Name,1)
ll_Max=UpperBound(lcd_Window.NestedClassList)
FOR ll_Counter=1 TO ll_Max
   tv_1.InsertItemLast(ll_Handle, &
   lcd_Window.NestedClassList[ll_Counter].Name,1)
NEXT

LISTING 3: CHOOSE A TARGET

window	lw_Sheet
string	ls_Path, ls_File
IF GetFileOpenName( "Choose Target",ls_Path,ls_File,&
   "PBT","PowerBuilder Targets (*.pbt),*.pbt")>0 &
   THEN
   OpenSheetWithParm( lw_Sheet, ls_Path, "w_main", This )
END IF

LISTING 4: PARSE THE LIBRARY LIST

/* Name: of_ParseLibList
Parameters: string as_PBT
Returns: (none)
*/

long	ll_Handle
string	ls_Line, ls_Path
integer li_Pos

// Open the target file
ll_Handle=FileOpen(as_PBT)
DO WHILE FileRead(ll_Handle,ls_Line) > 0
   IF Lower(Left(ls_Line,7))="appname" THEN
      // Application name Found
      ls_Line=Mid(ls_Line,8)
      ls_Line=Mid(ls_Line,Pos(ls_Line,'"')+1)
      This.Title=Left( ls_Line, Pos( ls_Line, '"' ) - 1 )
   END IF
   IF Lower(Left(ls_Line,7))="liblist" THEN
      // LibraryList Found
      EXIT
   END IF
LOOP
FileClose( ll_Handle )

// Get the Path the target file resides in
ls_Path=Left(as_PBT,LastPos(as_PBT,"\"))

// Parse the Library List
li_Pos=Pos(ls_Line,'"')
ls_Line=Mid(ls_Line,li_Pos+ 1)
// Add semicolon that all the library entries end with ;
ls_Line=Left(ls_Line,Pos( ls_Line,'"')-1) + ";"
li_Pos=Pos(ls_Line,";")
DO WHILE li_Pos > 0
   il_LibList[UpperBound(il_LibList)+1]= &
      ls_Path+Left(ls_Line,li_Pos - 1)
   ls_Line=Mid(ls_Line,li_Pos+1)
   li_Pos=Pos(ls_Line,";")
LOOP

RETURN

LISTING 5: INITIAL FILLING OF THE TREEVIEW CONTROL

integer	li_Counter
long	ll_Handle
treeviewitem 	ll_Tvi

// Get the LibraryList
This.of_ParseLibList(  message.stringparm )

ll_Handle=tv_1.InsertItemLast(0,This.Title,1)
FOR li_Counter=1 TO UpperBound(il_LibList)
   // Label is name only, full pathname is in Data
   ll_Tvi.Label=Mid(il_LibList[li_Counter], &
      LastPos( il_LibList[li_Counter],"\")+1)
   ll_Tvi.Data=il_LibList[li_Counter]
   ll_Tvi.Pictureindex=2
   ll_Tvi.SelectedPictureindex=2
   // Force the + sign to expand
   ll_Tvi.children=TRUE
   tv_1.InsertItemLast(ll_Handle,ll_Tvi)
NEXT

RETURN