Problem in xBrowse FWH 16.11

Problem in xBrowse FWH 16.11

Postby Maurizio » Wed Dec 07, 2016 3: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
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Problem in xBrowse FWH 16.11

Postby joseluisysturiz » Thu Dec 08, 2016 4: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!
User avatar
joseluisysturiz
 
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela

Re: Problem in xBrowse FWH 16.11

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem in xBrowse FWH 16.11

Postby Maurizio » 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
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Problem in xBrowse FWH 16.11

Postby nageswaragunupudi » 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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem in xBrowse FWH 16.11

Postby Maurizio » Fri Dec 09, 2016 2:20 pm

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
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Problem in xBrowse FWH 16.11

Postby nageswaragunupudi » Fri Dec 09, 2016 2:45 pm

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem in xBrowse FWH 16.11

Postby Maurizio » Fri Dec 09, 2016 2:54 pm

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

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

Re: Problem in xBrowse FWH 16.11

Postby Maurizio » Mon Dec 12, 2016 2:02 pm

Rao ,
the sample works with FWH 16.10

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

Re: Problem in xBrowse FWH 16.11

Postby nageswaragunupudi » Mon Dec 12, 2016 2:18 pm

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
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem in xBrowse FWH 16.11

Postby Maurizio » Mon Dec 12, 2016 2: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
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Problem in xBrowse FWH 16.11

Postby nageswaragunupudi » Thu Dec 15, 2016 12:14 am

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

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem in xBrowse FWH 16.11

Postby nageswaragunupudi » Thu Dec 15, 2016 4:04 am

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
   
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Problem in xBrowse FWH 16.11

Postby Maurizio » Thu Dec 15, 2016 8:38 am

Thanks Rao ,

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

You advice to change xbrowsenew() ?

Regards MAurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Problem in xBrowse FWH 16.11

Postby nageswaragunupudi » Thu Dec 15, 2016 9: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: Select all  Expand view

oBrw:nEditTypes := aEditable
 

is all that is needed
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 107 guests