Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Treeview or MShflexgrid
Message
De
06/12/2006 05:48:44
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
06/12/2006 01:44:05
Suhas Hegde
Dental Surgeon
Sirsi, Inde
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
01174842
Message ID:
01175135
Vues:
18
>>
>>TEXT TO m.strShape TEXTMERGE PRETEXT 8
>>shape append
>> new adChar(10) as Region,
>> new adInteger as RegionID,
>> ((shape append
>> new adChar(20) as Series,
>> new adInteger as RegionID )
>> as ls relate regionID to RegionID)
>>ENDTEXT
>
>
>thanx
>
>Can you highlight more ?
>How can i do the above without using shape ?
>
>m.ors1 = createobject("adodb.recordset")
>m.ors1.fields.append("region",adchar,10)
>m.ors1.fields.append("regionid",adinteger)
>
>now how to add the series recordset and relate?
>
>suhashegde

If you're doing hierarchical (that's if you need +/- for bands. bands property is readonly) AFAIK you can't do w/o "MSDataShape". However MSDataShape can fabricate recordsets (as shown in code), bind to VFP data (or any other OLEDB), or to XML.
In code check how it adds series recordet as 'child' to 'ls' relation.
Here is some code doing that with tables (direct table is commented):
TESTDATALOC = _samples+"data\testdata.DBC"

PUBLIC oForm
oForm = createobject('myForm')
oForm.Show

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 Init
    Local oRecordset,oConnection, strCn, strShp

    strCn =	[Provider=MSDataShape;Persist Security Info=False;]+;
      [Data Source=]+TESTDATALOC+[;Data Provider=VFPOLEDB]

*!*	    strShp = [SHAPE TABLE customer ]+;
*!*	      [  APPEND ( (SHAPE TABLE orders   ]+;
*!*	      [    APPEND (TABLE orditems RELATE order_id TO order_id)) ]+;
*!*	      [  RELATE cust_id TO cust_id ) ]

    strShp = [SHAPE {select Company,Cust_id from customer} as Customers ]+;
      [  APPEND ( {select cust_id,order_date,order_id from orders} RELATE cust_id TO cust_id ) ]

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

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

    With oRecordset
      .ActiveConnection = oConnection
      .Source = strShp
      .Open
    Endwith

    With this.hflex
      .Datasource = oRecordset
      .GridColorBand(0) = rgb(255,0,0)
      .GridColorBand(1) = rgb(0,0,255)
      .Cols(0) = 2
      .ColWidth(0,0) = 16*15
      .ColWidth(1,0) = 250*15
      .CollapseAll
*      .BandDisplay = 1
    Endwith
  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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform