Page 1 of 1

XBrowse: error in LastDisplayPos() method [Solved]

Posted: Thu Nov 05, 2020 9:21 am
by Enrico Maria Giordano
I get error doing oBrw:InsCol( nPos ). This is the line from xbrowse.prg:

Code: Select all

nWidth += ::ColAtPos( nPos++ ):nWidth + COL_SEPARATOR
And this is the error message:

Code: Select all

   Error description: Error BASE/1081  Argument error: +
   Args:
     [   1] = U   
     [   2] = N   2
It looks as ::ColAtPos( nPos++ ):nWidth is NIL.

Any workaround?

EMG

Re: XBrowse: error in LastDisplayPos() method

Posted: Fri Nov 06, 2020 9:33 am
by Enrico Maria Giordano
This is a sample showing the problem, if you need it:

Code: Select all

#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

Re: XBrowse: error in LastDisplayPos() method

Posted: Fri Nov 06, 2020 10:09 am
by nageswaragunupudi
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

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()
 

Re: XBrowse: error in LastDisplayPos() method

Posted: Fri Nov 06, 2020 10:26 am
by Enrico Maria Giordano
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

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

Posted: Fri Nov 06, 2020 11:53 am
by nageswaragunupudi
InsCol
sorry
not InsertCol