Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treeview or MShflexgrid
Message
From
05/12/2006 18:05:20
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
05/12/2006 01:00:48
Suhas Hegde
Dental Surgeon
Sirsi, India
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 6 SP5
Miscellaneous
Thread ID:
01174842
Message ID:
01175072
Views:
22
This message has been marked as the solution to the initial question of the thread.
>hi,
>
>I have a graph control which has many regions.
>I would like to show in the Treeview or H flexgrid control the series name and color the text of the series name with the associated color of the series in the graph
>
>Eg :
>
>- Region 1
>|--- lineseries 1 - this will be in blue color as the the series in the graph is blue
>|--- lineseries 2 - this will be in red color as the the series in the graph is red
>
>...and so on
>
>I cannot control which color to use because the use will select the color.
>
>How can i do the same in Treeview/ Hflexgrid ?
>
>Is this possible ?
>
>suhashegde
Local rs As adodb.recordset
Local cn As adodb.Connection

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

#include adoconstants.h
cn = Createobject("adodb.connection")
rs = Createobject("adodb.recordset")
cn.ConnectionString = "Provider=MsDataShape;Data Provider=NONE"
cn.Open()
rs.Open(m.strShape,cn,adOpenStatic,adLockOptimistic)

For regions=1 To 3
    rs.AddNew
    rs.Fields("region").Value = "Region"+PADL(m.regions,2)
    rs.Fields("regionID").Value = m.regions
    For lseries = 1 To 5
        rs2 = rs.Fields("ls").Value
        rs2.AddNew
        rs2.Fields("Series").Value = "R"+PADL(m.regions,2)+":Line series"+PADL(m.lseries,2)
    Endfor
Endfor

ShowMe(rs)

Function ShowMe(toRecordSet)
Public oForm
oForm = Createobject('myForm', toRecordSet)
oForm.Show
Endfunc

Define Class myform As Form
    Height = 450
    Width = 750
    Name = "Form1"

    Add Object hflex As OleControl With ;
        Top = 10, Left = 10, Height = 430, Width = 730, Name = "Hflex", ;
        OleClass = 'MSHierarchicalFlexGridLib.MSHFlexGrid'

    Procedure Init
    Lparameters toRecordSet
    With This.hflex
        .Datasource = toRecordSet
        .AllowUserResizing = 3
        .Cols(0) = 2
        .Cols(1) = 1
        .ColWidth(0,0) = 16*15
        .ColWidth(0,1) = 100*15
        
       	.Col = 2
       	.ColSel = 2
        FOR ix = .FixedRows TO .Rows-1
        	.Row = m.ix
        	.RowSel = m.ix
        	DO case
        	CASE ix%5=0
        	lnColor = RGB(255,255,0)
        	CASE ix%4=0
        	lnColor = RGB(0,255,255)
        	CASE ix%3=0
        	lnColor = RGB(192,192,0)
        	CASE ix%2=0
        	lnColor = RGB(0,192,192)
        	OTHERWISE
        	lnColor = RGB(192,192,192)
        	ENDCASE
        	.CellBackColor = m.lnColor
        ENDFOR  
    Endwith
    Endproc
Enddefine
PS: You can do that with TV too. Then set oNode.BackColor = rgb(whatever).
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