XBrowse: error in LastDisplayPos() method [Solved]

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

XBrowse: error in LastDisplayPos() method [Solved]

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: XBrowse: error in LastDisplayPos() method

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

Re: XBrowse: error in LastDisplayPos() method

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

G. N. Rao.
Hyderabad, India
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: XBrowse: error in LastDisplayPos() method

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

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

Post by nageswaragunupudi »

InsCol
sorry
not InsertCol
Regards

G. N. Rao.
Hyderabad, India
Post Reply