Alaska Software Inc. - XbpBrowse colPos question
Username: Password:
AuthorTopic: XbpBrowse colPos question
Claudio Driussi XbpBrowse colPos question
on Fri, 28 Sep 2018 11:15:32 +0200
Hi everybody,

with Xbase++ 1.9 if CursorMode is XBPBRW_CURSOR_ROW clicking a
column the colPos ivar changes to the clicked column, and with
Xbase++ 2.0 remain always the same and I must change from
XBPBRW_CURSOR_ROW to XBPBRW_CURSOR_CELL to select the column.

There is a way to know the last clicked column with XBPBRW_CURSOR_ROW
in Xbase++ 2.0 ?

Thanks
Claudio
Andreas Gehrs-Pahl
Re: XbpBrowse colPos question
on Fri, 28 Sep 2018 07:51:19 -0400
Claudio,

>There is a way to know the last clicked column with XBPBRW_CURSOR_ROW
>in Xbase++ 2.0 ?

Alaska changed the XbpBrowse:GotoItem() method in version 2.0.547 -- 
probably to (slightly) improve performance -- to only update the ::ColPos 
iVar in XBPBRW_CURSOR_CELL mode. If you have the professional subscription, 
you can change the "..\Source\Runtime\DUI\xbp-browse.prg" program and 
recompile the "xppdui.dll" and use that new DLL in your runtime. 

Alternatively, you can subclass the XbpBrowse class and fix it that way.

At the end of the XbpBrowse:GotoItem() method, replace the following lines:

IF nCol != ::ColPos .AND. ::CursorMode == XBPBRW_CURSOR_CELL
   ::HandleEvent(xbeBRW_Navigate, XBPBRW_Navigate_SkipCols, nCol - ::ColPos)
ENDIF

with this:

IF nCol != ::ColPos
   IF ::CursorMode == XBPBRW_CURSOR_CELL
      ::HandleEvent(xbeBRW_Navigate, XBPBRW_Navigate_SkipCols, nCol - ::ColPos)
   ELSE
      ::ColPos := nCol
   ENDIF
ENDIF

Alternatively, if you use a subclass, you could do something like this:

Class MyXbpBrowse from XbpBrowse
  [...]
  Protected:
  [...]
  Method GotoItem
  [...]
End Class

Method MyXbpBrowse:GotoItem(nRow, nCol, lDehilite)
LOCAL lReturn := Super:GotoItem(nRow, nCol, lDehilite)
   if ::CursorMode == XBPBRW_CURSOR_ROW
      ::ColPos := nCol
   endif
return (lReturn)

Hope that helps,

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas@AbsoluteSoftwareLLC.com
web:   http://www.AbsoluteSoftwareLLC.com
[F]:   https://www.facebook.com/AbsoluteSoftwareLLC
Claudio Driussi Re: XbpBrowse colPos question
on Fri, 28 Sep 2018 16:55:22 +0200
Il 28/09/2018 13:51, Andreas Gehrs-Pahl ha scritto:

>> There is a way to know the last clicked column with XBPBRW_CURSOR_ROW
>> in Xbase++ 2.0 ?
> 
> Alaska changed the XbpBrowse:GotoItem() method in version 2.0.547 --
> probably to (slightly) improve performance -- to only update the ::ColPos
> iVar in XBPBRW_CURSOR_CELL mode. If you have the professional subscription,
> you can change the "..\Source\Runtime\DUI\xbp-browse.prg" program and
> recompile the "xppdui.dll" and use that new DLL in your runtime.

No, I have the foudation subscription.

> Alternatively, you can subclass the XbpBrowse class and fix it that way.

But this is a better solution anyway.

> Class MyXbpBrowse from XbpBrowse
>    [...]
>    Protected:
>    [...]
>    Method GotoItem
>    [...]
> End Class
> 
> Method MyXbpBrowse:GotoItem(nRow, nCol, lDehilite)
> LOCAL lReturn := Super:GotoItem(nRow, nCol, lDehilite)
>     if ::CursorMode == XBPBRW_CURSOR_ROW
>        ::ColPos := nCol
>     endif
> return (lReturn)
> 
> Hope that helps,

Great! It works like a charm.

Thanks.

Claudio