Page 1 of 1

Problem in xBrowse FWH 16.11

PostPosted: Wed Dec 07, 2016 3:21 pm
by Maurizio
Hello ,
I have this error with xbrowse ,

Error description: Error BASE/1076 Parametro errato: >=
Args:
[ 1] = N 24
[ 2] = U
Stack Calls
===========
Called from: => NUMERIC:__OPGREATEREQUAL( 0 )
Called from: C:\FWH_16\my_fw\XBROWSE.PRG => TXBRWCOLUMN:PAINTCELL( 11898 )


temporarily I solved in this way

if HB_IsNumeric(nBmpWidth) .And. oRect:nWidth >= nBmpWidth //aBitmap[ BITMAP_WIDTH ]

Regards Maurizio
http://www.nipeservice.com

Re: Problem in xBrowse FWH 16.11

PostPosted: Thu Dec 08, 2016 4:57 pm
by joseluisysturiz
Saludos, pareciera que estas haciendo comparacion de un valor numerico con un objeto o una var que no tiene valor definido, revisa el tipo de valor de los valores que estas operando, saludos... :shock:

Re: Problem in xBrowse FWH 16.11

PostPosted: Thu Dec 08, 2016 11:09 pm
by nageswaragunupudi
Mr Maurizio

1) With the modification you made, runtime error is avoided, but bitmaps for the column are not painted. Right?
2) Can you also please clarify if you have assigned oCol:bBmpData, after calling oBrw:CreateFromCode() or after activating the dialog?

Re: Problem in xBrowse FWH 16.11

PostPosted: Fri Dec 09, 2016 10:38 am
by Maurizio
Mr Rao

1) With the modification you made, runtime error is avoided, but bitmaps for the column are not painted. Right?

I use :SetCheck() standard without assign a BMP

REDEFINE XBROWSE oBrw RECORDSET oRs ID 110 OF oDlg

the bitmap are notpainted

If I add a column at bStart , i see the bitmap.

Regards Maurizio

Re: Problem in xBrowse FWH 16.11

PostPosted: Fri Dec 09, 2016 11:45 am
by nageswaragunupudi
If we define browse something like

REDEFINE XBROWSE oBrw RECORDSET oRs ID 110 OF oDlg ;
COLUMNS FIRST, MARRIED, CITY

oBrw:aCols[ 1 ]:SetCheck()

ACTIVATE DIALOG oDlg

The setcheck bitmap is painted.

May I know how are you defining the columns?

Re: Problem in xBrowse FWH 16.11

PostPosted: Fri Dec 09, 2016 2:20 pm
by Maurizio
Rao ,
I modified c:\fwh\samples\xbrwalia.prg
Code: Select all  Expand view
#include "FiveWin.ch"
#include "XBrowse.ch"

function Main()

   local oDlg, oBrw

   USE Clients

   USE Customer NEW

   DEFINE DIALOG oDlg RESOURCE "Test"

   REDEFINE XBROWSE oBrw ID 10 OF oDlg AUTOCOLS ALIAS "Customer"
   
   
   REDEFINE BUTTON ID 20 OF oDlg ACTION Customer->( oBrw:SetRDD() )
   
   REDEFINE BUTTON ID 30 OF oDlg ACTION Clients->( oBrw:SetRDD() )

   odlg:bStart := {||oBrw:aCols[ 8 ]:SetCheck() }

   ACTIVATE DIALOG oDlg

return nil


when you move with the arrow on the right you see the error


Regards MAurizio

Re: Problem in xBrowse FWH 16.11

PostPosted: Fri Dec 09, 2016 2:45 pm
by nageswaragunupudi
Do the two tables Customer and Clients have the same Structure ?

Re: Problem in xBrowse FWH 16.11

PostPosted: Fri Dec 09, 2016 2:54 pm
by Maurizio
Rao ,
I use this sample because are in fwh standard folder ( xbrwalia.prg ) , you can try only with customer.dbf table .
Code: Select all  Expand view
function Main()

   local oDlg, oBrw

   USE Customer NEW

   DEFINE DIALOG oDlg RESOURCE "Test"

   REDEFINE XBROWSE oBrw ID 10 OF oDlg AUTOCOLS ALIAS "Customer"
     
   REDEFINE BUTTON ID 20 OF oDlg ACTION Customer->( oBrw:SetRDD() )

   odlg:bStart := {||oBrw:aCols[ 8 ]:SetCheck() }

   ACTIVATE DIALOG oDlg

return nil

 

Re: Problem in xBrowse FWH 16.11

PostPosted: Mon Dec 12, 2016 2:02 pm
by Maurizio
Rao ,
the sample works with FWH 16.10

Maurizio

Re: Problem in xBrowse FWH 16.11

PostPosted: Mon Dec 12, 2016 2:18 pm
by nageswaragunupudi
Please see lines 11896 to 11898
Original code
Code: Select all  Expand view
     nBmpWidth   := ::nBmpWidth

      if oRect:nWidth >= nBmpWidth //aBitmap[ BITMAP_WIDTH ]
 

Please keep this code as it is and insert these lines above 11896
Code: Select all  Expand view
     if Empty( ::nBmpWidth )
         ::nBmpWidth := ::oBrw:nRowHeight
      endif
 

Re: Problem in xBrowse FWH 16.11

PostPosted: Mon Dec 12, 2016 2:50 pm
by Maurizio
Thanks Rao,
works very well :D

I use xbrowse in this way because the end user can customize the browse.
I have a table (field_table) with field names that the customer wants to see.
So before loading all fields with
REDEFINE XBROWSE oBrw ID 10 OF oDlg AUTOCOLS ALIAS "Customer"
then compare fields with table (field_table) and delete the unused columns .

You think there is a better way to do this?

Regards Maurizio
http://www.nipeservice.com

Re: Problem in xBrowse FWH 16.11

PostPosted: Thu Dec 15, 2016 12:14 am
by nageswaragunupudi
Please try something similar to this:

Method-1

Code: Select all  Expand view

aCols := {}
USE fieldtable NEW
// Next read all the fieldnames into an array
DBEVAL( { || AAdd( aCols, TRIM( FIELD->fldname ) ) } )

REDEFINE XBROWSE oBrw ID 10 OF oDlg COLUMNS aCols ALIAS "Customer"
 


Method-2

Code: Select all  Expand view

aCols := {}
USE fieldtable NEW
// Next read all the fieldnames into an array
DBEVAL( { || AAdd( aCols, TRIM( FIELD->fldname ) ) } )

REDEFINE XBROWSE oBrw ID 10 OF oDlg AUTOCOLS ALIAS "Customer"
oBrw:ReArrangeCols( aCols, .f. )
 


Please let us know if you need any more clarification on this.

Re: Problem in xBrowse FWH 16.11

PostPosted: Thu Dec 15, 2016 4:04 am
by nageswaragunupudi
Taking this further, you can store more parameters in the DBF
Code: Select all  Expand view
aCols := {}
aHead := {}
aPict := {}
aSize := {}

USE BRWSPECS NEW  // DBF containing browse spectifications

DBEVAL( { || ;
   AAdd( aCols, TRIM( FIELD->DATA ) ), ;
   AAdd( aHead, If( Empty( FIELD->HEAD ), nil, TRIM( FIELD->HEAD ) ), ;
   AAdd( aPict, If( EMPTY( FIELD->PICT ), nil, TRIM( FIELD->PICT ) ), ;
   AAdd( aPict, If( Empty( FIELD->SIZE ), nil, FIELD->SIZE ) } )
   
REDEFINE XBROWSE oBrw ID 10 OF oDlg DATASOURCE "Customer" ;
   COLUMNS aCols HEADERS aHead PICTURES aPict COLSIZES aSize
   
 

Re: Problem in xBrowse FWH 16.11

PostPosted: Thu Dec 15, 2016 8:38 am
by Maurizio
Thanks Rao ,

I have other two parameters : EDITABLE , ig field is LOGIC or Not .

You advice to change xbrowsenew() ?

Regards MAurizio

Re: Problem in xBrowse FWH 16.11

PostPosted: Thu Dec 15, 2016 9:28 am
by nageswaragunupudi
You advice to change xbrowsenew() ?

Kindly do not use xbrowsenew() directly in the application. We need it.

EDITABLE , ig field is LOGIC or Not .


Logical or Not:
This is not necessary. XBrowse is capable of knowing which fields are logical.

if we call oBrw:SetChecks(), xbrowse sets every logical column with SetCheck()

EDITABLE:
Yes. you may have this column.

After creating XBrowse

Code: Select all  Expand view

oBrw:nEditTypes := aEditable
 

is all that is needed