FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Error in xbrowse May 2017
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM

Error in xbrowse May 2017

Posted: Wed Jun 07, 2017 02:11 PM
Hello Rao ,

in April 2017 this sample works .
The problem is :cEditPicture := "999999" when there are no records .

Code (fw): Select all Collapse
#include "fivewin.ch"
static oCn
function Main()
   local oDlg, oFont, oBrw 
   local oStates, oCust
   FW_SetUnicode( .f. )
   if ( oCn := FW_DemoDB() ) == nil
      return nil
   endif

   //oStates   := oCn:RowSet( "states" ) // Create Parent
   oStates   := oCn:RowSet( "select * from states wher id = -1" ) // Create Parent
   
   XBROWSE(oStates)
   
   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 900,600 PIXEL TRUEPIXEL ;
      FONT oFont ;
      TITLE "FWH MYSQL PARENT CHILD ROWSET"

   @ 20,20 XBROWSE oBrw SIZE 250,-20 PIXEL OF oDlg ;
      DATASOURCE oStates ;
      COLUMNS "Code" ; //, "Name" ;
      COLSIZES nil  ; // , 50 ;
      CELL LINES NOBORDER
     
    WITH OBJECT oBrw:InsCol(1)
       :cHeader       := "id"
       :bEditValue := { || oStates:Fields( "ID" ):Value    }
       //:cEditPicture  := "@ZE 999999.999"
       :cEditPicture  := "999999"
       
    END   
   WITH OBJECT oBrw 
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

   ocn:close()
   RETURN NIL

return nil


Regards Maurizio
www.nipeservice.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Error in xbrowse May 2017

Posted: Wed Jun 07, 2017 07:30 PM

What error you are getting?
I tried and did not get any error.

BTW hope you know you can also write oStates:ID instead of oStates:Fields( "id" ):Value

Regards



G. N. Rao.

Hyderabad, India
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM

Re: Error in xbrowse May 2017

Posted: Thu Jun 08, 2017 06:42 AM

Rao
I Have this error
Application
===========
Path and name: C:\FWH_16\samples\MARIA_01.exe (32 bits)
Size: 3,933,696 bytes
Compiler version: Harbour 3.2.0dev (r1703231115)
FiveWin version: FWH 17.05
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200

Time from start: 0 hours 0 mins 3 secs
Error occurred at: 06/08/17, 08:40:11
Error description: Error BASE/1106 Argument error: REPLICATE
Args:
[ 1] = C B
[ 2] = U

Stack Calls

Called from: => REPLICATE( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:DATATEXTWIDTH( 11594 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:DATAWIDTH( 11516 )
Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:ADJUST( 10969 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:ADJUST( 1331 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:INITIATE( 1184 )
Called from: => __OBJSENDMSG( 0 )
Called from: .\source\function\HARBOUR.PRG => OSEND( 291 )
Called from: .\source\function\HARBOUR.PRG => ASEND( 259 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:INITIATE( 655 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT( 906 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 296 )
Called from: maria_01.prg => MAIN( 48 )

Maurizio

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Error in xbrowse May 2017

Posted: Thu Jun 08, 2017 01:53 PM
I noticed this bug recently. But this should not affect your program when the field is numeric. It affects when the inserted expression is character type and picture clause is provided.

This is fixed for 17.06.

You may please apply this fix.
Please locate the following code in
METHOD DataTextWidth( lCurrent ) CLASS TXBrwColumn
Code (fw): Select all Collapse
   if !Empty( ::cEditPicture ) .and. cType $ "CN+"
      lUser    := .t.
   endif

Please modify the first line of the above code as below
Code (fw): Select all Collapse
   if !Empty( ::cEditPicture ) .and. cType $ "N+" // <-- here
      lUser    := .t.
   endif
Regards



G. N. Rao.

Hyderabad, India
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM

Re: Error in xbrowse May 2017

Posted: Thu Jun 08, 2017 02:27 PM

Thanks Rao :D

--- BTW hope you know you can also write oStates:ID instead of oStates:Fields( "id" ):Value
It's possible use with ADO ? ( In my programma I use ADO :( )

Maurizoi

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Error in xbrowse May 2017

Posted: Thu Jun 08, 2017 02:46 PM

No. Not possible with ADO RecordSet object.

I thought you are using FWMARIADB.

ADO syntax works both with ADO and FWMARIADB.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion