oTree for xBrowse sample...
oTree for xBrowse sample...
Hi!
Anybody with working sample using Tree for xBrowse for DBFCDX table....
Best Regards,
Frances
Anybody with working sample using Tree for xBrowse for DBFCDX table....
Best Regards,
Frances
Kind Regards,
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
Frances
Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Detlef Hoefner
- Posts: 312
- Joined: Sat Oct 08, 2005 9:12 am
- Location: Germany
- Contact:
Antonio,Antonio Linares wrote:Frances,
You can use the source code for MakeTree() in samples\TestXbr3.prg
Just use the DBF instead of an ADO recordset. The source code is almost the same.
i'm also very interested in a sample how to use this tree browse with dbf files.
Unfortunatelly it's not so easy to find a replacement for the 'union' clause of a sql query.
Could you please provide a pure dbf sample for this useful feature or give us some tips?
This woulds be great.
Thanks and regards,
Detlef
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Frances, Detlef,
Here you have a working example:
Here you have a working example:
Code: Select all
#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
local oWnd, oBrw
USE Customer
INDEX ON Field->State TO State
SET ORDER TO "State"
GO TOP
DEFINE WINDOW oWnd TITLE "DbfTree"
@ 0, 0 XBROWSE oBrw OF oWnd LINES CELL
oBrw:SetTree( BuildTree() )
oBrw:CreateFromCode()
oBrw:aCols[ 1 ]:cHeader = "State"
oWnd:oClient = oBrw
ACTIVATE WINDOW oWnd
return nil
static function BuildTree()
local oTree, cState
TREE oTree
while ! Eof()
if Empty( cState )
_TreeItem( Customer->State ):Cargo := RecNo()
TREE
cState = Customer->State
else
if cState != Customer->State
ENDTREE
cState = Customer->State
_TreeItem( Customer->State ):Cargo := RecNo()
TREE
endif
endif
if Customer->State == cState
_TreeItem( Customer->City ):Cargo := RecNo()
endif
SKIP
enddo
ENDTREE
ENDTREE
GO TOP
return oTree
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Detlef Hoefner
- Posts: 312
- Joined: Sat Oct 08, 2005 9:12 am
- Location: Germany
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Using bitmaps in the tree:
Test.prg
Test.rc
Test.prg
Code: Select all
#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
local oWnd, oBrw
USE Customer
INDEX ON Field->State TO State
SET ORDER TO "State"
GO TOP
DEFINE WINDOW oWnd TITLE "DbfTree"
@ 0, 0 XBROWSE oBrw OF oWnd LINES CELL
oBrw:SetTree( BuildTree(), { "open", "close", "go" } )
oBrw:CreateFromCode()
oBrw:aCols[ 1 ]:cHeader = "State"
oWnd:oClient = oBrw
ACTIVATE WINDOW oWnd
return nil
static function BuildTree()
local oTree, cState
TREE oTree
while ! Eof()
if Empty( cState )
_TreeItem( Customer->State ):Cargo := RecNo()
TREE
cState = Customer->State
else
if cState != Customer->State
ENDTREE
cState = Customer->State
_TreeItem( Customer->State ):Cargo := RecNo()
TREE
endif
endif
if Customer->State == cState
_TreeItem( Customer->City ):Cargo := RecNo()
endif
SKIP
enddo
ENDTREE
ENDTREE
GO TOP
return oTree
Code: Select all
open BITMAP "c:\fwh\bitmaps\16x16\folder2.bmp"
close BITMAP "c:\fwh\bitmaps\16x16\folder.bmp"
go BITMAP "c:\fwh\bitmaps\16x16\go.bmp"
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
With multiple columns:
test.prg
test.prg
Code: Select all
#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
local oWnd, oBrw
USE Customer
INDEX ON Field->State TO State
SET ORDER TO "State"
GO TOP
DEFINE WINDOW oWnd TITLE "DbfTree"
@ 0, 0 XBROWSE oBrw OF oWnd LINES CELL
oBrw:SetTree( BuildTree(), { "open", "close", "go" } )
ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 1 ] HEADER "Last"
ADD TO oBrw DATA oBrw:oTreeItem:Cargo[ 2 ] HEADER "First"
oBrw:CreateFromCode()
oBrw:aCols[ 1 ]:cHeader = "State"
oWnd:oClient = oBrw
ACTIVATE WINDOW oWnd
return nil
static function BuildTree()
local oTree, cState
TREE oTree
while ! Eof()
if Empty( cState )
_TreeItem( Customer->State ):Cargo := { Space( 20 ), Space( 20 ) }
TREE
cState = Customer->State
else
if cState != Customer->State
ENDTREE
cState = Customer->State
_TreeItem( Customer->State ):Cargo := { Space( 20 ), Space( 20 ) }
TREE
endif
endif
if Customer->State == cState
_TreeItem( Customer->City ):Cargo := { Customer->Last, Customer->First }
endif
SKIP
enddo
ENDTREE
ENDTREE
GO TOP
return oTree
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
In order to open the browse tree with the keyboard (return key) this change in Class TXBrowse is required:
In the example, to select the entire row:
Code: Select all
METHOD KeyChar( nKey, nFlags ) CLASS TXBrowse
...
case nKey == VK_RETURN
oCol := ::SelectedCol()
if oCol:nEditType > 0
...
else
If( ::oTreeItem:oTree != nil,( ::oTreeItem:Toggle(), ::Refresh() ),) // new !!!
endif
...
Code: Select all
oBrw:nMarqueeStyle = MARQSTYLE_HIGHLROW
Thankyou Mr.Antonio,
Modifying the xBrowse.Prg means either I have to include the modified xBrowse.Prg along with my project
or
I should generate FiveH.Lib (Harbour) and FiveHx.Lib (xHarbour) to generate a modified lib to reflect the changes made in xBrowse.Prg. Am I right ?.
Is there a batch file available to generate FiveH.Lib and FiveHx.Lib ?.
Sorry for asking questions which is out of topic of this particular thread. I thought it might be useful for beginners like me who read this thread.
Would have been better if we had some solution without altering the xBrowse source.
Regards
Anser
Modifying the xBrowse.Prg means either I have to include the modified xBrowse.Prg along with my project
or
I should generate FiveH.Lib (Harbour) and FiveHx.Lib (xHarbour) to generate a modified lib to reflect the changes made in xBrowse.Prg. Am I right ?.
Is there a batch file available to generate FiveH.Lib and FiveHx.Lib ?.
Sorry for asking questions which is out of topic of this particular thread. I thought it might be useful for beginners like me who read this thread.
Would have been better if we had some solution without altering the xBrowse source.
Regards
Anser
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Anser,
You can do it both ways:
1: Modify xbrowse.prg and compile it and link it as another PRG of your application.
2: Modify xbrowse.prg and compile it and update FiveH.lib or FiveHX.lib (if you use Harbour or xHarbour)
To rebuild the library you can use this batch file:
You can do it both ways:
1: Modify xbrowse.prg and compile it and link it as another PRG of your application.
2: Modify xbrowse.prg and compile it and update FiveH.lib or FiveHX.lib (if you use Harbour or xHarbour)
To rebuild the library you can use this batch file:
Code: Select all
for %%f in (*.prg) do c:\harbour\bin\harbour %%f /n /ic:\fwh\include;c:\harbour\include
for %%f in (*.c) do c:\bcc55\bin\bcc32 -c -Ic:\bcc55\include;c:\harbour\include %%f
for %%f in (*.obj) do c:\bcc55\bin\tlib fiveh.lib -+ %%f /0 /P32,,