XBrowse: error in LastDisplayPos() method [Solved]

XBrowse: error in LastDisplayPos() method [Solved]

Postby Enrico Maria Giordano » Thu Nov 05, 2020 9:21 am

I get error doing oBrw:InsCol( nPos ). This is the line from xbrowse.prg:

Code: Select all  Expand view
nWidth += ::ColAtPos( nPos++ ):nWidth + COL_SEPARATOR


And this is the error message:

Code: Select all  Expand view
  Error description: Error BASE/1081  Argument error: +
   Args:
     [   1] = U  
     [   2] = N   2


It looks as ::ColAtPos( nPos++ ):nWidth is NIL.

Any workaround?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8709
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: XBrowse: error in LastDisplayPos() method

Postby Enrico Maria Giordano » Fri Nov 06, 2020 9:33 am

This is a sample showing the problem, if you need it:

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oBrw

    USE CUSTOMER

    DEFINE DIALOG oDlg;
           SIZE 800, 600

    @ 0, 0 XBROWSE oBrw ALIAS "CUSTOMER";
           ON RIGHT CLICK oBrw:InsCol( 1 )

    oBrw:CreateFromCode()

    ACTIVATE DIALOG oDlg;
             ON INIT oBrw:AdjClient();
             CENTER

    CLOSE

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8709
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: XBrowse: error in LastDisplayPos() method

Postby nageswaragunupudi » Fri Nov 06, 2020 10:09 am

You just inserted a column, but did not assign data, header, width, etc and did not call adjust.

We recommend using command syntax.

Otherwise:
Code: Select all  Expand view

WITH oBrw:InsertCol( nPos )
   :bEditValue := { |x| ... } // bSetGet
   :cHeader := <header>
   :nWidth :=  <width in pixels>
   :bOnPostEdit := // if you want edit
   // more depending on your requirements
   :Adjust()
END
oBrw:Refresh()
 
Regards

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

Re: XBrowse: error in LastDisplayPos() method

Postby Enrico Maria Giordano » Fri Nov 06, 2020 10:26 am

Please check you suggestion, it's not going to work. InsertCol()? :-)

Anyway, I understood that I have to assign at least the new column width, thank you.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8709
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: XBrowse: error in LastDisplayPos() method [Solved]

Postby nageswaragunupudi » Fri Nov 06, 2020 11:53 am

InsCol
sorry
not InsertCol
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 52 guests