Problem in xBrowse FWH 16.11

Post Reply
User avatar
Maurizio
Posts: 826
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Problem in xBrowse FWH 16.11

Post 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
User avatar
joseluisysturiz
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela
Contact:

Re: Problem in xBrowse FWH 16.11

Post 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:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Problem in xBrowse FWH 16.11

Post 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?
Regards

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

Re: Problem in xBrowse FWH 16.11

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

Re: Problem in xBrowse FWH 16.11

Post 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?
Regards

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

Re: Problem in xBrowse FWH 16.11

Post by Maurizio »

Rao ,
I modified c:\fwh\samples\xbrwalia.prg

Code: Select all | Expand

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

Re: Problem in xBrowse FWH 16.11

Post by nageswaragunupudi »

Do the two tables Customer and Clients have the same Structure ?
Regards

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

Re: Problem in xBrowse FWH 16.11

Post 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

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

 
User avatar
Maurizio
Posts: 826
Joined: Mon Oct 10, 2005 1:29 pm
Contact:

Re: Problem in xBrowse FWH 16.11

Post by Maurizio »

Rao ,
the sample works with FWH 16.10

Maurizio
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Problem in xBrowse FWH 16.11

Post by nageswaragunupudi »

Please see lines 11896 to 11898
Original code

Code: Select all | Expand

     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

     if Empty( ::nBmpWidth )
         ::nBmpWidth := ::oBrw:nRowHeight
      endif
 
Regards

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

Re: Problem in xBrowse FWH 16.11

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

Re: Problem in xBrowse FWH 16.11

Post by nageswaragunupudi »

Please try something similar to this:

Method-1

Code: Select all | Expand


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


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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Problem in xBrowse FWH 16.11

Post by nageswaragunupudi »

Taking this further, you can store more parameters in the DBF

Code: Select all | Expand

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
   
 
Regards

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

Re: Problem in xBrowse FWH 16.11

Post by Maurizio »

Thanks Rao ,

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

You advice to change xbrowsenew() ?

Regards MAurizio
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Problem in xBrowse FWH 16.11

Post 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


oBrw:nEditTypes := aEditable
 

is all that is needed
Regards

G. N. Rao.
Hyderabad, India
Post Reply