FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBrowse: error in LastDisplayPos() method [Solved]
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

XBrowse: error in LastDisplayPos() method [Solved]

Posted: Thu Nov 05, 2020 09:21 AM
I get error doing oBrw:InsCol( nPos ). This is the line from xbrowse.prg:

Code (fw): Select all Collapse
nWidth += ::ColAtPos( nPos++ ):nWidth + COL_SEPARATOR


And this is the error message:

Code (fw): Select all Collapse
   Error description: Error BASE/1081  Argument error: +
   Args:
     [   1] = U   
     [   2] = N   2


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

Any workaround?

EMG
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: XBrowse: error in LastDisplayPos() method

Posted: Fri Nov 06, 2020 09:33 AM
This is a sample showing the problem, if you need it:

Code (fw): Select all Collapse
#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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: XBrowse: error in LastDisplayPos() method

Posted: 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 (fw): Select all Collapse
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
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Re: XBrowse: error in LastDisplayPos() method

Posted: 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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

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

Posted: Fri Nov 06, 2020 11:53 AM

InsCol
sorry
not InsertCol

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion