Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Hierarchy grid
Message
From
07/10/2003 08:08:34
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
07/10/2003 07:30:02
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00835694
Message ID:
00835706
Views:
14
>HI,
>Is it possible to display hierarchy data in grid or other control?
>
>Thank you

Display means only view ? :) If so I think the most suitable control is MS HFlexgrid activex (you could do with native grid too but is like a tooth pull).
However you need to learn MS Shaping a bit.
ie: (This is maybe the simpliest form of shape command)
TESTDATALOC = _samples+"data\testdata.DBC"

oForm = Createobject('myForm')
oForm.Show
Read Events

Define Class myform As Form
  Top = 0
  Left = 0
  Height = 450
  Width = 750
  DoCreate = .T.
  Caption = "Form1"
  Name = "Form1"

  Add Object hflex As OleControl With ;
    Top = 0, ;
    Left = 0, ;
    Height = 420, ;
    Width = 750, ;
    Name = "Hflex", ;
    OleClass = 'MSHierarchicalFlexGridLib.MSHFlexGrid'

  Procedure LoadSet
  Local oRecordset,oConnection, strCn, strShp

  strCn =	[Provider=MSDataShape.1;Persist Security Info=False;]+;
    [Data Source="Data Provider = MSDASQL;]+;
[DSN=Visual FoxPro Database;UID=;SourceDB=]+TESTDATALOC+[;]+;
[SourceType=DBC;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;Null=Yes;]+;
[Deleted=Yes;";Data Provider=MSDASQL ]


  oRecordset = Createobject("adodb.recordset")
  oConnection = Createobject("adodb.connection")

  With oConnection
    .Provider = "MSDataShape"
    .ConnectionString = strCn
    .Open
  Endwith

  strShp = [SHAPE TABLE customer ]+;
    [  Append ( (Shape Table orders   ]+;
    [    Append (Table orditems Relate order_id To order_id)) ]+;
    [  Relate cust_id To cust_id ) ]
  With oRecordset
    .ActiveConnection = oConnection
    .Source = strShp
    .Open
  Endwith

  With This.hflex
    .Datasource = oRecordset
    .Mergecells = 3
    .GridColorBand(1) = Rgb(255,0,0)
    .GridColorBand(2) = Rgb(0,0,255)
    .GridColorBand(3) = Rgb(0,255,0)
    .ColWidth(0,0) = 300
    .CollapseAll
  Endwith
Endproc

  Procedure Init
  With This
    .hflex.Height = .Height
    .hflex.Width = .Width
    .LoadSet()
  Endwith
Endproc
  Procedure QueryUnload
  Clear Events
Endproc
Enddefine
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform