Page 1 of 1

BUG with itemmarked in DCBROWSE?

Posted: Sat Mar 05, 2011 2:34 am
by skiman
Hi Roger,

I think there is a bug in dcbrowse concerning the ITEMMARKED codeblock, it is NOT always fired!

I have a database browse with documents. There are three buttons with 'Show orders', 'Show delivery notes' and 'Show invoices'.

At startup the invoices are shown. There is a setscope, the invoices appears, I do a gobottom so the last line is selected AND the itemmarked is fired.

Now I click the button to show the orders. This is what happens in my code:
- dc_setscope
- oBrowse:gobottom()
- oBrowse:forceStable()

The orders are shown, and the last record is selected. However the ITEMMARKED is NOT fired. When I select this line with a single click OR a double click, the ITEMMARKED is not fired.

This way the ITEMSELECTED codeblock is started, without the ITEMMARKED. This can have unpredictable results according to the use of the codeblock.

I would prefer there is a parameter for the DCBROWSE that the ITEMMARKED is fired each time there happens something with the browse.

I also have the following situation.
- PC1: Line with invoice is selected in a browse, and the itemmarked is fired. The browse stays on the screen.
- PC2: Someone changes something in this invoice.
- PC1: Select the same line with a single click. The ITEMMARKED isn't fired. In some cases I would prefer to have the possibility to force this.

I can't find in the sources where there is a check if the eval(itemmarked) has to be executed or not. I hoped I could find something as oBrowse:lFireItemmarked := .T. to force this.

Re: BUG with itemmarked in DCBROWSE?

Posted: Sat Mar 05, 2011 9:02 am
by rdonnay
Chris -

I usually do a :refreshAll() after a :forceStable().
I think that this will generate the xbeBRW_itemMarked event.

You can also do it this way:

Code: Select all

- dc_setscope
- oBrowse:gobottom()
- oBrowse:forceStable()
PostAppEvent(xbeBRW_ItemMarked,,,oBrowse)
Roger

Re: BUG with itemmarked in DCBROWSE?

Posted: Sun Mar 06, 2011 2:13 am
by jdsoft
Hello,

I use the oBrowse:StableBlock callback slot. Works like a charm.

Code: Select all

LOCAL bMemo          := {||cMemo := DC_GetColArray(10,oBrowse), Dc_GetRefresh(GetList,,,,"PERM")}

@ nLine, 2  DCBROWSE oBrowse DATA oDb:oPermanent:aDetails SIZE 80,4.5 NOHSCROLL ;
            CURSORMODE XBPBRW_CURSOR_ROW FIT;
            EVAL {|o|o:stableBlock := bMemo} POINTER nPointer 
Regards,
Jack Duijf

Re: BUG with itemmarked in DCBROWSE?

Posted: Mon Mar 07, 2011 12:58 am
by skiman
Hi Roger, Jack,

I will try the postappevent,this should work.

I wasn't aware about the existence of the :stableblock. I will check this.

Re: BUG with itemmarked in DCBROWSE?

Posted: Sat Mar 12, 2011 2:56 am
by skiman
rdonnay wrote: I usually do a :refreshAll() after a :forceStable().
I think that this will generate the xbeBRW_itemMarked event.
No, the itemmarked isn't fired.
rdonnay wrote: You can also do it this way:

Code: Select all

- dc_setscope
- oBrowse:gobottom()
- oBrowse:forceStable()
PostAppEvent(xbeBRW_ItemMarked,,,oBrowse)
Seems as this isn't doing anything at all. It doesn't fire the event as expected.
I added the following to check

Code: Select all

PostAppEvent(xbeBRW_ItemMarked,,,oBrowse)
wtf 'postevent'
I see it is executed, but the 'wtf' from the itemmarked isn't shown.

Re: BUG with itemmarked in DCBROWSE?

Posted: Sat Mar 12, 2011 3:07 am
by skiman
jdsoft wrote: I use the oBrowse:StableBlock callback slot. Works like a charm.

Code: Select all

LOCAL bMemo          := {||cMemo := DC_GetColArray(10,oBrowse), Dc_GetRefresh(GetList,,,,"PERM")}

@ nLine, 2  DCBROWSE oBrowse DATA oDb:oPermanent:aDetails SIZE 80,4.5 NOHSCROLL ;
            CURSORMODE XBPBRW_CURSOR_ROW FIT;
            EVAL {|o|o:stableBlock := bMemo} POINTER nPointer 
Hi Jack,

The stableblock is always executed. Seems as this is the most reliable to work with.