XBrowse and add column
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
XBrowse and add column
Hi to all,
I doing some tests about xbrowse to evaluate a migration from the "old" tcbrowse and I did find a problem using the ADD COLUMN command that generate an error.
This is a self-contained code that show the problem:
#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
aNames:={}
aadd(aNames,{1,"Marc","4th Floor","Queens House"})
aadd(aNames,{2,"Marc","4th Floor","Queens House"})
aadd(aNames,{3,"Marc","4th Floor","Queens House"})
aadd(aNames,{4,"Marc","4th Floor","Queens House"})
DEFINE dialog OWND TITLE "xBrowse tests" FROM 5,5 TO 40,80
@1,1 XBROWSE oBrw ARRAY aNames
ADD COLUMN TO oBrw DATA ARRAY ELEM 1
ADD COLUMN TO oBrw DATA ARRAY ELEM 2
ACTIVATE dialog OWND
I think the problem is into the xbrowse.ch that translate the command using the tcbrowse functions instead of the new xbrowse function.
Is there any solution ?
I need to manage single "ADD COLUMN"
so I can't assign the columns immediatly when I call the XBROWSE command.
I doing some tests about xbrowse to evaluate a migration from the "old" tcbrowse and I did find a problem using the ADD COLUMN command that generate an error.
This is a self-contained code that show the problem:
#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
aNames:={}
aadd(aNames,{1,"Marc","4th Floor","Queens House"})
aadd(aNames,{2,"Marc","4th Floor","Queens House"})
aadd(aNames,{3,"Marc","4th Floor","Queens House"})
aadd(aNames,{4,"Marc","4th Floor","Queens House"})
DEFINE dialog OWND TITLE "xBrowse tests" FROM 5,5 TO 40,80
@1,1 XBROWSE oBrw ARRAY aNames
ADD COLUMN TO oBrw DATA ARRAY ELEM 1
ADD COLUMN TO oBrw DATA ARRAY ELEM 2
ACTIVATE dialog OWND
I think the problem is into the xbrowse.ch that translate the command using the tcbrowse functions instead of the new xbrowse function.
Is there any solution ?
I need to manage single "ADD COLUMN"
so I can't assign the columns immediatly when I call the XBROWSE command.
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Mr Marco
>
I think the problem is into the xbrowse.ch that translate the command using the tcbrowse functions instead of the new xbrowse function.
>
You are right. Till FWH rectifies the command translate, I advise you to add new columns the way I do.
The above code is equivalent to
ADD COLUMN TO oBrw DATA ARRAY ELEM 1
xBrowse takes care of minimum formatting requirements, whatever the data type.
>
I think the problem is into the xbrowse.ch that translate the command using the tcbrowse functions instead of the new xbrowse function.
>
You are right. Till FWH rectifies the command translate, I advise you to add new columns the way I do.
Code: Select all
oCol := oBrw:AddCol()
oCol:nArrayCol := 1 // the column number
ADD COLUMN TO oBrw DATA ARRAY ELEM 1
xBrowse takes care of minimum formatting requirements, whatever the data type.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- 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:
Marco,
Please replace this command inside include/xbrowse.ch, thanks
Please replace this command inside include/xbrowse.ch, thanks
Code: Select all
#command ADD [ COLUMN ] [<oCol>] TO [ XBROWSE ] <oBrw> [ DATA ] ARRAY ;
[ AT <nAt> ] ;
[ <el: ELM, ELEM, ELEMENT> <elm> ] ;
[ <tit: TITLE, HEADER> <cHead> [ <oem: OEM, ANSI, CONVERT>] ];
[ <clr: COLORS, COLOURS> <uClrFore> [,<uClrBack>] ] ;
[ ALIGN ] [ <al: LEFT, CENTERED, RIGHT> ] ;
[ <wid: WIDTH, SIZE> <nWidth> [ PIXELS ] ] ;
[ <pict: PICT, PICTURE> <cPicture> ] ;
[ <bit: BITMAP> ] ;
[ <edit: EDITABLE> ] ;
[ ON EDIT <bOnPostEdit> ] ;
[ MESSAGE <cMsg> ] ;
[ WHEN <uWhen> ] ;
[ VALID <uValid> ] ;
[ ERROR [MSG] [MESSAGE] <cErr> ] ;
[ <lite: NOBAR, NOHILITE> ] ;
[ <idx: ORDER, INDEX, TAG> <nOrder> ] ;
=> ;
[<oCol> :=] XbrwAddColumn( <oBrw>, ;
If(<.oem.>, OemToAnsi(<cHead>), <cHead>), ;
<elm>, <cPicture>, ;
[<uClrFore>], [<uClrBack>], ;
[ Upper( <(al)> ) ], <nWidth>, <.bit.>, ;
<.edit.>, <bOnPostEdit>, <cMsg>, <{uWhen}>, <{uValid}>, <cErr>, <.lite.>, <nOrder>, <nAt> )
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
Thanks Antonio.
It runs now, but there is still a problem using bitmaps.
In this sample code I try to display the 5th Array element that is a bitmap but it is displayed as "Object" in the browse.
Did I forget somethings ?
Full code with executable and bitmaps available at:
www.softwarexp.co.uk/beta/xtest.zip
Thanks.
#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
DEFINE BITMAP oGreen FILENAME "16green.bmp"
DEFINE BITMAP oRed FILENAME "16red.bmp"
aNames:={}
aadd(aNames,{1,"Marc","4th Floor","Queens House",oRed})
aadd(aNames,{2,"Marc","4th Floor","Queens House",oRed})
aadd(aNames,{3,"Marc","4th Floor","Queens House",oGreen})
aadd(aNames,{4,"Marc","4th Floor","Queens House",oGreen})
DEFINE dialog oDlg TITLE "xBrowse tests" FROM 5,5 TO 40,80
@1,1 XBROWSE oBrw ARRAY aNames of oDlg
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 1;
HEADER "Num" SIZE 30 LEFT
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 2;
HEADER "Name" SIZE 80
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 5;
HEADER "Status" SIZE 80 BITMAP
oBrw:CreateFromCode()
ACTIVATE dialog oDlg
It runs now, but there is still a problem using bitmaps.
In this sample code I try to display the 5th Array element that is a bitmap but it is displayed as "Object" in the browse.
Did I forget somethings ?
Full code with executable and bitmaps available at:
www.softwarexp.co.uk/beta/xtest.zip
Thanks.
#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
DEFINE BITMAP oGreen FILENAME "16green.bmp"
DEFINE BITMAP oRed FILENAME "16red.bmp"
aNames:={}
aadd(aNames,{1,"Marc","4th Floor","Queens House",oRed})
aadd(aNames,{2,"Marc","4th Floor","Queens House",oRed})
aadd(aNames,{3,"Marc","4th Floor","Queens House",oGreen})
aadd(aNames,{4,"Marc","4th Floor","Queens House",oGreen})
DEFINE dialog oDlg TITLE "xBrowse tests" FROM 5,5 TO 40,80
@1,1 XBROWSE oBrw ARRAY aNames of oDlg
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 1;
HEADER "Num" SIZE 30 LEFT
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 2;
HEADER "Name" SIZE 80
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 5;
HEADER "Status" SIZE 80 BITMAP
oBrw:CreateFromCode()
ACTIVATE dialog oDlg
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Marco,
This should be the way to do it:
This should be the way to do it:
Code: Select all
#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
local oGreen, oRed, oBrw, oDlg, aNames
/*
DEFINE BITMAP oGreen FILENAME "16green.bmp"
DEFINE BITMAP oRed FILENAME "16red.bmp"
*/
aNames:={}
aadd(aNames,{1,"Marc","4th Floor","Queens House", 2 }) //oRed})
aadd(aNames,{2,"Marc","4th Floor","Queens House", 2 }) //oRed})
aadd(aNames,{3,"Marc","4th Floor","Queens House", 1 }) //oGreen})
aadd(aNames,{4,"Marc","4th Floor","Queens House", 1 }) //oGreen})
DEFINE dialog oDlg TITLE "xBrowse tests" SIZE 600,300 PIXEL
@ 10,10 XBROWSE oBrw ARRAY aNames of oDlg SIZE 280,130 PIXEL
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 1;
HEADER "Num" SIZE 30 LEFT
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 2;
HEADER "Name" SIZE 80
ADD COLUMN TO XBROWSE oBrw ; // DATA ARRAY ELEM 5;
HEADER "Status" SIZE 80 BITMAP // BITMAP syntax has not effect now. Will be fixed in 8.06
WITH OBJECT oBrw:oCol( "Status" )
:bBmpData := { || oBrw:aRow[ 5 ] }
:AddBmpFile( "16green.bmp" )
:AddBmpFile( "16red.bmp" )
END
oBrw:CreateFromCode()
ACTIVATE dialog oDlg
return nil
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
Solved, thanks.
There is a problem also with the AUTOSORT paramet.
It doen't runs if I use the ADD COLUMN command to define the column (see code below).
It is not urgent for me but I advise you about this problem.
..
..
DEFINE dialog oDlg TITLE "xBrowse tests" FROM 5,5 TO 40,80
@1,1 XBROWSE oBrw ARRAY aNames of oDlg AUTOSORT
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 1;
HEADER "Num" SIZE 30 LEFT
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 2;
HEADER "Name" SIZE 80
..
..
There is a problem also with the AUTOSORT paramet.
It doen't runs if I use the ADD COLUMN command to define the column (see code below).
It is not urgent for me but I advise you about this problem.
..
..
DEFINE dialog oDlg TITLE "xBrowse tests" FROM 5,5 TO 40,80
@1,1 XBROWSE oBrw ARRAY aNames of oDlg AUTOSORT
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 1;
HEADER "Num" SIZE 30 LEFT
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 2;
HEADER "Name" SIZE 80
..
..
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Marco,
The clause AUTOSORT applies for all the columns created by the @ <r>,<c> XBROWSE or REDEFINE XBROWSE command. Example :
To specify sorting while adding a column, specify the clause ORDER <cnOrder> IN THE ADD command. Example:
The clause AUTOSORT applies for all the columns created by the @ <r>,<c> XBROWSE or REDEFINE XBROWSE command. Example :
Code: Select all
@ 10,10 XBROWSE oBrw ;
COLUMNS 1, 2 ;
HEADERS "Num", "Name" ;
COLSIZES 30, 80 ;
ARRAY aNames of oDlg SIZE 280,130 PIXEL AUTOSORT
Code: Select all
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 2;
HEADER "Name" SIZE 80 ORDER 2
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
You are right. It runs fine. Thanks.
In the meantime I have found other two bugs
1) using the SORT 2 command in a bitmap column an error appairs
2) using the :ToExcel method in a browse with a bitmap column exist then the bitmap column is not exported (correct !!) but the header of the bitmap column is exported moving all headers on the right.
I have found some sample turn-around for these errors
but a fix in the xbrowse class will be appreciated.
Thanks.
In the meantime I have found other two bugs
1) using the SORT 2 command in a bitmap column an error appairs
2) using the :ToExcel method in a browse with a bitmap column exist then the bitmap column is not exported (correct !!) but the header of the bitmap column is exported moving all headers on the right.
I have found some sample turn-around for these errors
but a fix in the xbrowse class will be appreciated.
Thanks.
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Marco,
> In the meantime I have found other two bugs
Its working fine with FWH 8.05 here
>
1) using the SORT 2 command in a bitmap column an error appairs
>
ORDER not SORT. If you want a bitmap column to be sorted, there should be some value in the bEditValue.
Here is the right way to code, in the above sample:
>
2) using the :ToExcel method in a browse with a bitmap column exist then the bitmap column is not exported (correct !!) but the header of the bitmap column is exported moving all headers on the right.
>
Working fine with 8.05
> In the meantime I have found other two bugs
Its working fine with FWH 8.05 here
>
1) using the SORT 2 command in a bitmap column an error appairs
>
ORDER not SORT. If you want a bitmap column to be sorted, there should be some value in the bEditValue.
Here is the right way to code, in the above sample:
Code: Select all
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 5 ;
HEADER "Status" SIZE 80 BITMAP ORDER 5
WITH OBJECT oBrw:oCol( "Status" )
:bBmpData := { || oBrw:aRow[ 5 ] }
:AddBmpFile( "16green.bmp" )
:AddBmpFile( "16red.bmp" )
END
2) using the :ToExcel method in a browse with a bitmap column exist then the bitmap column is not exported (correct !!) but the header of the bitmap column is exported moving all headers on the right.
>
Working fine with 8.05
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
It is all right now about bitmap sorting but could you pls. explain me better about the cnOrder valute to assign with ORDER ?
Is it the column number or what is it ? If I assign to cnOrder a random value I can always sorting that column pressing the header.
With reference to the excel export I have the following error:
Application
===========
Path and name: K:\TEST\SEND\XTEST.EXE (32 bits)
Size: 1,579,008 bytes
Time from start: 0 hours 0 mins 5 secs
Error occurred at: 06/11/08, 19:58:43
Error description: Error Excel.Application:ACTIVESHEET:COLUMNS/0 S_OK: _STYLE
Args:
[ 1] = C Comma [0]
Stack Calls
===========
Called from: win32ole.prg => TOLEAUTO:_STYLE(0)
Called from: XBROWSE.PRG => TXBROWSE:TOEXCEL(0)
Called from: XTEST.PRG => (b)MAIN(39)
Do I need an updated xbrowse class ?
However I enclosed in a self-contained sample at www.softwarexp.co.uk/beta/xtest2.zip my current xbrowse class (from the May 2008 Fwh class folder) and the sample code that generate this error pressing the "Excel" button.
Thanks.
Is it the column number or what is it ? If I assign to cnOrder a random value I can always sorting that column pressing the header.
With reference to the excel export I have the following error:
Application
===========
Path and name: K:\TEST\SEND\XTEST.EXE (32 bits)
Size: 1,579,008 bytes
Time from start: 0 hours 0 mins 5 secs
Error occurred at: 06/11/08, 19:58:43
Error description: Error Excel.Application:ACTIVESHEET:COLUMNS/0 S_OK: _STYLE
Args:
[ 1] = C Comma [0]
Stack Calls
===========
Called from: win32ole.prg => TOLEAUTO:_STYLE(0)
Called from: XBROWSE.PRG => TXBROWSE:TOEXCEL(0)
Called from: XTEST.PRG => (b)MAIN(39)
Do I need an updated xbrowse class ?
However I enclosed in a self-contained sample at www.softwarexp.co.uk/beta/xtest2.zip my current xbrowse class (from the May 2008 Fwh class folder) and the sample code that generate this error pressing the "Excel" button.
Thanks.
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Marco,
With TXBrowse version 8.06 you can write
instead of
as required with earlier versions.
Excel export works perfectly with English versions. We are trying to make it compatible with international versions in other language. Please try again with version 8.06. Your feedback with details about the language of your installation will help us to make the functionality fully universal.
With TXBrowse version 8.06 you can write
Code: Select all
ADD COLUMN TO XBROWSE oBrw ARRAY ;
HEADER "Status" ;
BITMAP BMPDATA 5 IN "16green.bmp", "16red.bmp" ORDER 1
Code: Select all
ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 5 ;
HEADER "Status" SIZE 80 BITMAP ORDER 5
WITH OBJECT oBrw:oCol( "Status" )
:bBmpData := { || oBrw:aRow[ 5 ] }
:AddBmpFile( "16green.bmp" )
:AddBmpFile( "16red.bmp" )
END
Excel export works perfectly with English versions. We are trying to make it compatible with international versions in other language. Please try again with version 8.06. Your feedback with details about the language of your installation will help us to make the functionality fully universal.