Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Microsoft: FoxPro FAQ

Classes and Objects

How to use the Outline Control Activex to show a directory . by Mike Gagnon
Posted: 30 Jan 03

Here is an example of showing a directory structure using the seldom used Outline Control (This sample assumes that the Outline Control exist on your system which comes installed with Visual Studio or Visual Studio .NET - File name MSOutl32.OCX). Copy the following in a program and run it.

Public oform1
Define Class form1 As Form
    Height = 352
    Width = 433
    DoCreate = .T.
    AutoCenter = .T.
    Caption = "Demo directory display"
    AlwaysOnTop = .T.
    Name = "Form1"
    Add Object text1 As TextBox With ;
        Height = 25, ;
        Left = 12, ;
        Top = 312, ;
        Width = 265, ;
        BackColor = Rgb(192,192,192), ;
        Name = "Text1"
    Add Object command1 As CommandButton With ;
        AutoSize = .T., ;
        Top = 312, ;
        Left = 288, ;
        Height = 27, ;
        Width = 88, ;
        Caption = "Get Directory", ;
        Name = "Command1"
    Procedure createarray
    Lparameters m.path, m.nlevel, m.nCount
    Local DirArr,i,nTotDir,lvl
    Store 0 To i,lvl,Cnt
    m.path = Alltrim(m.path)
    If Parameters()<2 Or Type("m.nlevel") #"N"
        lvl = 0
        lvl = m.nlevel
    If Parameters()<2 Or Type("m.nCount") #"N"
        Cnt = 0
        Cnt = m.nCount
    lvl = lvl + 1
    Cnt = Cnt + 1
    o = This.oleOut
    If Cnt = 1

    Dimension DirArr[1,1]
    For i = 1 To m.nTotDir
        If DirArr[m.i,1] != '.' And DirArr[m.i,1] != '..' And Atc('D',DirArr[m.i,5])#0
            This.createarray(m.path+DirArr[m.i,1]+'\', m.lvl, m.cnt)
    Procedure command1.Click
    Local cDir
    If Thisform.oleOut.Object.ListCount > 0
    cDir = Getdir()
    If Empty(m.cDir)
        Thisform.text1.Value = m.cDir
    If Thisform.oleOut.Object.ListCount>0
Define Class out As OleControl
    Top = 24
    Left = 24
    Height = 193
    Width = 289
    Visible = .T.

Mike Gagnon

Back to Microsoft: FoxPro FAQ Index
Back to Microsoft: FoxPro Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close