Page 1 of 2

DCBROWSE - row cursor on/off

Posted: Fri Feb 25, 2022 3:24 am
by Maxz
I point out some strange behaviors in the DCBROWSE when i disable/enable highlight cursor in XBPBRW_CURSOR_ROW mode

// enable row cursor
oBrowse:cursorMode := XBPBRW_CURSOR_ROW
oBrowse:configure()
oBrowse:hilite()
oBrowse:refreshCurrent()
oBrowse:forceStable()

this works



// disable row cursor
oBrowse:cursorMode := XBPBRW_CURSOR_NONE
oBrowse:configure()
oBrowse:deHilite()
oBrowse:refreshCurrent()
oBrowse:forceStable()

the row cursor remains highlighted - then the row cursor stay hidden (if i try to move it using keyboard or mouse)

Re: DCBROWSE - row cursor on/off

Posted: Fri Feb 25, 2022 3:40 am
by Tom
Maybe you dehilite the browse before you set the cursor to "NONE"?

Re: DCBROWSE - row cursor on/off

Posted: Fri Feb 25, 2022 3:45 am
by Maxz
I'm trying all the combinations, for example:

oBrowse:deHilite()
oBrowse:refreshCurrent()
oBrowse:cursorMode := XBPBRW_CURSOR_NONE
oBrowse:configure()

the cursor always remains on

Re: DCBROWSE - row cursor on/off

Posted: Fri Feb 25, 2022 3:57 am
by Maxz
in addition oBrowse:forceStable() return an object instead of logical value, as the xbase manual show:

":forceStable() returns .T. (true) when the display is stable. "

so I can't even create the usual loop to stabilize the browse:
do while !oBrowse:forceStable(); enddo

Re: DCBROWSE - row cursor on/off

Posted: Fri Feb 25, 2022 4:33 am
by Tom
Just call oBrowse:ForceStable() once, this contains the complete stabilization loop.

Re: DCBROWSE - row cursor on/off

Posted: Fri Feb 25, 2022 5:11 am
by Maxz
<<msg to Roger>>
I looked at Roger's source (xbp_brw.prg) and I saw that the method that refreshes the line is PROTECTED
METHOD HiliteColumns // hilite the specified columns

I wanted to force the refresh of the line to turn it off but I do not know how to get around the problem
screen.jpg
screen.jpg (205.86 KiB) Viewed 5753 times

Re: DCBROWSE - row cursor on/off

Posted: Fri Feb 25, 2022 5:17 am
by Auge_Ohr
hi Maxz
Maxz wrote: Fri Feb 25, 2022 3:57 am ":forceStable() returns .T. (true) when the display is stable. "
"think GUI"
"o:Forcestable" was used with TBrowse but XbpBrowse() have Callback-Slot "o:stableBlock" for it

under Cl*pper you did "say" what have to do
under GUI you are waiting and "react" what User did

so "fill" Callback-Slot "o:stableBlock" for your "Action" when oBrowse is "stable"

Re: DCBROWSE - row cursor on/off

Posted: Fri Feb 25, 2022 8:03 am
by Maxz
I found the way to solve the problem, after so many attempts:

cursor row enabled:
oBrowse:hilite()
AEval( oBrowse:aColumns, {|o| o:Redraw() } )


cursor row disabled:
oBrowse:deHilite()
AEval( oBrowse:aColumns, {|o| o:Redraw() } )

:dance:

Re: DCBROWSE - row cursor on/off

Posted: Fri Feb 25, 2022 8:04 am
by rdonnay
I just tested this and it works fine for me.

Code: Select all

STATIC FUNCTION CursorOn( oBrowse )

oBrowse:cursorMode := XBPBRW_CURSOR_ROW
oBrowse:configure()
oBrowse:hilite()
oBrowse:forceStable()
oBrowse:refreshCurrent()
SetAppFocus(oBrowse)

RETURN nil

* ------------

STATIC FUNCTION CursorOff( oBrowse )

oBrowse:cursorMode := XBPBRW_CURSOR_NONE
oBrowse:configure()
oBrowse:dehilite()
oBrowse:forceStable()
oBrowse:refreshCurrent()
SetAppFocus(oBrowse)

RETURN nil

Re: DCBROWSE - row cursor on/off

Posted: Fri Feb 25, 2022 8:33 am
by Maxz
tried it but the on/off switch mechanism seams not work for me
attach, a small example to play ...
temp.zip
(62.18 KiB) Downloaded 402 times