Error in xbrowse May 2017

Post Reply
User avatar
Maurizio
Posts: 833
Joined: Mon Oct 10, 2005 1:29 pm
Been thanked: 1 time
Contact:

Error in xbrowse May 2017

Post by Maurizio »

Hello Rao ,

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

Code: Select all | Expand


#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
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: Error in xbrowse May 2017

Post by nageswaragunupudi »

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
User avatar
Maurizio
Posts: 833
Joined: Mon Oct 10, 2005 1:29 pm
Been thanked: 1 time
Contact:

Re: Error in xbrowse May 2017

Post by Maurizio »

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
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: Error in xbrowse May 2017

Post by nageswaragunupudi »

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


   if !Empty( ::cEditPicture ) .and. cType $ "CN+"
      lUser    := .t.
   endif
 

Please modify the first line of the above code as below

Code: Select all | Expand


   if !Empty( ::cEditPicture ) .and. cType $ "N+" // <-- here
      lUser    := .t.
   endif
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
Maurizio
Posts: 833
Joined: Mon Oct 10, 2005 1:29 pm
Been thanked: 1 time
Contact:

Re: Error in xbrowse May 2017

Post by Maurizio »

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
User avatar
nageswaragunupudi
Posts: 10733
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 11 times
Contact:

Re: Error in xbrowse May 2017

Post by nageswaragunupudi »

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
Post Reply