FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem in xBrowse FWH 16.11
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Problem in xBrowse FWH 16.11
Posted: Wed Dec 07, 2016 03:21 PM
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
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: Problem in xBrowse FWH 16.11
Posted: Thu Dec 08, 2016 04:57 PM

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!
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem in xBrowse FWH 16.11
Posted: Thu Dec 08, 2016 11:09 PM

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
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: Problem in xBrowse FWH 16.11
Posted: Fri Dec 09, 2016 10:38 AM

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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem in xBrowse FWH 16.11
Posted: Fri Dec 09, 2016 11:45 AM

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
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: Problem in xBrowse FWH 16.11
Posted: Fri Dec 09, 2016 02:20 PM
Rao ,
I modified c:\fwh\samples\xbrwalia.prg
Code (fw): Select all Collapse
#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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem in xBrowse FWH 16.11
Posted: Fri Dec 09, 2016 02:45 PM

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

Regards



G. N. Rao.

Hyderabad, India
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: Problem in xBrowse FWH 16.11
Posted: Fri Dec 09, 2016 02:54 PM
Rao ,
I use this sample because are in fwh standard folder ( xbrwalia.prg ) , you can try only with customer.dbf table .
Code (fw): Select all Collapse
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
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: Problem in xBrowse FWH 16.11
Posted: Mon Dec 12, 2016 02:02 PM

Rao ,
the sample works with FWH 16.10

Maurizio

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem in xBrowse FWH 16.11
Posted: Mon Dec 12, 2016 02:18 PM
Please see lines 11896 to 11898
Original code
Code (fw): Select all Collapse
      nBmpWidth   := ::nBmpWidth

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

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



G. N. Rao.

Hyderabad, India
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: Problem in xBrowse FWH 16.11
Posted: Mon Dec 12, 2016 02:50 PM

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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem in xBrowse FWH 16.11
Posted: Thu Dec 15, 2016 12:14 AM
Please try something similar to this:

Method-1

Code (fw): Select all Collapse
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 (fw): Select all Collapse
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem in xBrowse FWH 16.11
Posted: Thu Dec 15, 2016 04:04 AM
Taking this further, you can store more parameters in the DBF
Code (fw): Select all Collapse
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
Posts: 842
Joined: Mon Oct 10, 2005 01:29 PM
Re: Problem in xBrowse FWH 16.11
Posted: Thu Dec 15, 2016 08:38 AM

Thanks Rao ,

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

You advice to change xbrowsenew() ?

Regards MAurizio

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Problem in xBrowse FWH 16.11
Posted: Thu Dec 15, 2016 09:28 AM
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 (fw): Select all Collapse
oBrw:nEditTypes := aEditable

is all that is needed
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion