Using trees from XBrowse:
Using a brush for a specific column:
new XBrowse features for next build
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- patrickmast
- Posts: 39
- Joined: Tue Jan 24, 2006 6:16 pm
- Contact:
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Assuming you have grouped data and built a Tree, the code for browsing
the Tree is simple
Syntax: oBrw:SetTree( oTree, [ { resOpen, resClose [, resNoChildren ] } ], [ <bDataLink> ] )
Example:
XBrowse creates one column showing the oItem:cPrompt with the bitmaps specified. Based on nLevel, the cPrompt along with bitmaps, if any, is indented within the first column.
If there is any data linked to the TreeItems that is to be shown in the
next columns, simple alternative is to assign all such data as an array
to oItem:cargo. Then columns can be created for this data.
Example:
It is possible for some reason, you may not like to copy all the data into
arrays and assign to oItem:Cargo. This may be the case when the data is very large and copying all the data may be time consuming or memory intensive. In such cases, there is another alternative. You can assign to oItem:Cargo a pointer to the relavant row in the datsource. For example it can be RecNo() of DBF or AbsolutePosition of a Recordset, etc.
In such a case you need to specify a codeblock as 3rd paramter of SetTree method. The codebock can be like { |oItem| (cAlias)->( DbGoTo( oItem:Cargo ) ) }.
In that case, Browse object takes care of positioning the datasource by
evaluating the codeblock with every skip. Then you may add columns like this:
Rest are cosmetics. We welcome any suggestions for further simplification
the Tree is simple
Syntax: oBrw:SetTree( oTree, [ { resOpen, resClose [, resNoChildren ] } ], [ <bDataLink> ] )
Example:
Code: Select all
REDEFINE XBROWSE oBrw ID <id> OF oDlg
oBrw:SetTree( oTree, { "OPEN","CLOSE","NONE" } )
ACTIVATE DIALOG oDlg
If there is any data linked to the TreeItems that is to be shown in the
next columns, simple alternative is to assign all such data as an array
to oItem:cargo. Then columns can be created for this data.
Example:
Code: Select all
ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 1 ] PICTURE "999" HEADER "Employees"
ADD TO oBrw DATA oBrw:oTreeItem:cargo[ 2 ] PICTURE "999,999" HEADER "Salary"
arrays and assign to oItem:Cargo. This may be the case when the data is very large and copying all the data may be time consuming or memory intensive. In such cases, there is another alternative. You can assign to oItem:Cargo a pointer to the relavant row in the datsource. For example it can be RecNo() of DBF or AbsolutePosition of a Recordset, etc.
In such a case you need to specify a codeblock as 3rd paramter of SetTree method. The codebock can be like { |oItem| (cAlias)->( DbGoTo( oItem:Cargo ) ) }.
In that case, Browse object takes care of positioning the datasource by
evaluating the codeblock with every skip. Then you may add columns like this:
Code: Select all
ADD TO oBrw DATA (cAlias)->EMPCOUNT PICTURE "999" HEADER "Employees"
or
ADD TO oBrw oRs:Fields("TotSalary"):Value PICTURE "999,999" HEADER "TotSalary"
-
- Posts: 454
- Joined: Sun Oct 30, 2005 6:37 am
- Location: Guangzhou(Canton),China
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact: