XBrowse and add column

XBrowse and add column

Postby Marco Turco » Sat May 24, 2008 3:46 pm

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.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby nageswaragunupudi » Thu May 29, 2008 2:37 pm

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.
Code: Select all  Expand view  RUN
oCol := oBrw:AddCol()
oCol:nArrayCol := 1  // the column number


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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10659
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Postby Antonio Linares » Thu May 29, 2008 2:55 pm

Marco,

We are going to provide a modified xbrowse.ch asap, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Thu May 29, 2008 3:15 pm

Marco,

Please replace this command inside include/xbrowse.ch, thanks

Code: Select all  Expand view  RUN
#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> )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marco Turco » Sat May 31, 2008 1:05 pm

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
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Antonio Linares » Sun Jun 01, 2008 3:02 pm

Marco,

This should be the way to do it:
Code: Select all  Expand view  RUN
#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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marco Turco » Mon Jun 02, 2008 8:41 am

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
..
..
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Antonio Linares » Mon Jun 02, 2008 1:19 pm

Marco,

The clause AUTOSORT applies for all the columns created by the @ <r>,<c> XBROWSE or REDEFINE XBROWSE command. Example :
Code: Select all  Expand view  RUN
   @ 10,10 XBROWSE oBrw ;
      COLUMNS 1, 2 ;
      HEADERS "Num",  "Name" ;
      COLSIZES 30, 80 ;
      ARRAY aNames of oDlg SIZE 280,130 PIXEL AUTOSORT


To specify sorting while adding a column, specify the clause ORDER <cnOrder> IN THE ADD command. Example:
Code: Select all  Expand view  RUN
    ADD COLUMN TO XBROWSE oBrw DATA ARRAY ELEM 2;
        HEADER "Name" SIZE 80 ORDER 2
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marco Turco » Thu Jun 05, 2008 4:32 pm

You are right. It runs fine. Thanks.

In the meantime I have found other two bugs :D
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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Antonio Linares » Tue Jun 10, 2008 6:28 pm

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:
Code: Select all  Expand view  RUN
    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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Marco Turco » Wed Jun 11, 2008 6:13 pm

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.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Antonio Linares » Fri Jun 27, 2008 12:51 pm

Marco,

With TXBrowse version 8.06 you can write

Code: Select all  Expand view  RUN
    ADD COLUMN TO XBROWSE oBrw ARRAY ;
        HEADER "Status" ;
        BITMAP BMPDATA 5 IN "16green.bmp", "16red.bmp" ORDER 1




instead of

Code: Select all  Expand view  RUN
    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


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.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42125
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 42 guests