Page 1 of 1

Playing with XBROWSE

PostPosted: Thu Apr 06, 2023 4:57 pm
by Jimmy
hi,

i´m playing with XBROWSE and got a Error when did this from XBROWSE

a.) Dbf2HTML( cPath + cFile, cAlias )
b-) oBrwDBF:ToExcel()
Error description: (DOS Error -2147352567) WINOLE/1007 Die Paste-Eigenschaft des Worksheet-Objektes kann nicht zugeordnet werden. (0x800A03EC): Microsoft Office Excel

Stack Calls
===========
Called from: => TOLEAUTO:PASTE( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:TOEXCEL( 10792 )
Called from: .\DUALGRID.PRG => (b)DOSHOWDBF( 2572 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 792 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 1083 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1847 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 2135 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3681 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1114 )
Called from: .\DUALGRID.PRG => MAIN( 920 )

it does work when call oBrwDBF:ToExcel() "direct"

---

i have look for METHOD ToExcel but not found in Help File

Code: Select all  Expand view
METHOD ToExcel( bProgress, nGroupBy, aCols, lShow, cPDF, bPrePDF ) CLASS TXBrowse

i do understand cPDF but how Codeblock bPrePDF look like ... can´t find a Sample :?:

---

when add a new Record
Code: Select all  Expand view
  oBrwDBF:EditSource( .t. )

i got a Windows ... but i can´t find "the" Window ... "where" is it :?:

Question : can i set "color" to Window / Dialog like EditSource() :?:

Re: Playing with XBROWSE

PostPosted: Thu Apr 06, 2023 5:50 pm
by Jimmy
forgot to say dbf2html() is CODE from c:\fwh\samples\dbf2html.prg

Re: Playing with XBROWSE

PostPosted: Fri Apr 07, 2023 2:22 am
by nageswaragunupudi
Dbf2Html() uses the function FW_DBFTOHTML()
Did you get any error using this function?

This function has nothing to do with XBrowse and its method ToExcel(). May we know why are you combining Dbf2HTML() and XBrowse?

bPrePDF:

In case the programmer wants to make some additions to the excel sheeet before saving as PDF, he can do so by using bPrePdf codeblock, which is evaluated with oSheet as parameter.

We can not comment on the runtime error without knowing anything about the DBF or the program code of DoShowDBF()

Altenatively, can you suggest name of any dbf file in fwh\samples to test at our end?

Re: Playing with XBROWSE

PostPosted: Fri Apr 07, 2023 2:59 am
by nageswaragunupudi
when add a new Record
Code:
oBrwDBF:EditSource( .t. )

i got a Windows ... but i can´t find "the" Window ... "where" is it :?:

Question : can i set "color" to Window / Dialog like EditSource() :?:


We see Dialog (not Window).
When we use oBrw:EditSource( [lAppend] ) , XBrowse + DataRow display a default dialog that works with all kinds of datasources.
Programmer can use his own dialog by assigning
Code: Select all  Expand view

oBrw:bEdit := { |oRec| MyDialog( oRec ) }
 

When programmers uses his own dialog, he can use his own colors.

Image

Re: Playing with XBROWSE

PostPosted: Sun Apr 09, 2023 4:49 am
by Jimmy
hi,

thx for Answer.

as you say i have "mix" Dbf2Htm() and ToExcel(), sorry for confuse
We can not comment on the runtime error without knowing anything about the DBF or the program code of DoShowDBF()

i do start both from BUTTONBAR of XBROWSE
Code: Select all  Expand view
     DEFINE WINDOW oWnd FROM 0, 0 TO 1024, 1280 PIXEL TITLE "DBF " + cFile ICON "A1MAIN" COLOR BFcolor, BGcolor

         DEFINE BUTTONBAR oBar SIZE 96, 48 OF oWnd BRUSH oBrush

               DEFINE BUTTON OF oBar PROMPT "to &HTML" ;
                            NOBORDER RESOURCE "MYHTML" ;
                            ACTION Dbf2HTML( cPath + cFile, cAlias )

               DEFINE BUTTON OF oBar PROMPT "to &Excel" ;
                            NOBORDER RESOURCE "MYEXCEL" ;
                            ACTION oBrwDBF:ToExcel()

            @ 24,  0 XBROWSE oBrwDBF PIXEL OF oWnd ;
                                 FONT oFontDefault ;
                            COLOR BFcolor, BGcolor ;
                            ALIAS cAlias AUTOCOLS CELL LINES NOBORDER FASTEDIT

i do press Button for Dbf2HTML() and it work as expect
after close Dialog i press Button for oBrwDBF:ToExcel(). now it crash

it does not crask when ress Button for oBrwDBF:ToExcel() "direct", only in this "Combination"

When we use oBrw:EditSource( [lAppend] ) , XBrowse + DataRow display a default dialog that works with all kinds of datasources.

but "where" is the Dialog as i can´t find DEFINE DIALOG in Xbrowse.prg which point to it :?:

Re: Playing with XBROWSE

PostPosted: Sun Apr 09, 2023 6:16 am
by nageswaragunupudi
i do press Button for Dbf2HTML() and it work as expect
after close Dialog i press Button for oBrwDBF:ToExcel(). now it crash

The problem must be with the function Dbf2Html() as adapted by you.
Most likely you are closing DBFs before exiting the function.

I tested with this single line code and everything is working perfectly
Code: Select all  Expand view
  XBROWSER "CUSTOMER.DBF" FASTEDIT SETUP ( oBrw:bRClicked := ;
      { || MEMOWRIT( "x.html", FW_DBFTOHTML() ), ;
           HTMLVIEW( TrueName( "x.html" ) ) } )
 

Re: Playing with XBROWSE

PostPosted: Sun Apr 09, 2023 6:58 am
by Jimmy
hi,
nageswaragunupudi wrote:The problem must be with the function Dbf2Html() as adapted by you.
Most likely you are closing DBFs before exiting the function.

ok, understood

nageswaragunupudi wrote:I tested with this single line code and everything is working perfectly
Code: Select all  Expand view
  XBROWSER "CUSTOMER.DBF" FASTEDIT SETUP ( oBrw:bRClicked := ;
      { || MEMOWRIT( "x.html", FW_DBFTOHTML() ), ;
           HTMLVIEW( TrueName( "x.html" ) ) } )
 

thx, i will try that Syntax