Page 1 of 1

DCBROWSE ... DATATOOLTIP

Posted: Wed Mar 24, 2010 7:48 am
by Tom
Looks like the DATATOOLTIP/TIPBLOCK-clauses in browses showing arrays only work correctly if the array is already filled when the browse comes up.

Code: Select all

aDir := {}

@ 1,1 DCBROWSE oBrowse DATA aDir ... 
DCBROWSECOL ELEMENT 1 DATATOOLTIP {||.T.} TIPBLOCK {|n|Var2Char(aDir[n,1])}
...

DCREAD GUI EVAL {||aDir := Directory(),oBrowse:RefreshAll()}
In this case, no tooltip is shown and "n" is always "1". If the first line is changed to "aDir := Directory()" and this is removed from DCREAD ..., the TIPBLOCK works correctly.

Background: I have several browses showing different data depending on the user input in the same dialog, so the array contens changes. In those dialogs, the browses are initially empty.

Re: DCBROWSE ... DATATOOLTIP

Posted: Wed Mar 24, 2010 8:25 am
by rdonnay
I believe that this problem is due to the fact that you are creating a new array pointer and the tipblock is bound to the original pointer.

Try this:

Code: Select all

DCBROWSECOL ELEMENT 1 DATATOOLTIP {||.T.} TIPBLOCK {|n|Var2Char(aDir[n,1])}

DCREAD GUI EVAL {||FillArray(aDir)}

STATIC FUNCTION FillArray(aDir)

LOCAL aDir2

ASize(aDir,0)
aDir2 := Directory()
FOR i := 1 TO Len(aDir2)
  AAdd(aDir,aDir2[i])
NEXT

RETURN nil

Re: DCBROWSE ... DATATOOLTIP

Posted: Wed Mar 24, 2010 8:32 am
by Tom
Hi, Roger.

I checked this. I use DC_GetBrowArray(oBrowse,aArray) inside the function which refill the arrays.

Re: DCBROWSE ... DATATOOLTIP

Posted: Wed Mar 24, 2010 8:54 am
by rdonnay
It isn't the browse that's the problem, it's the tipblock.

Try my suggestion and see if it works.

Re: DCBROWSE ... DATATOOLTIP

Posted: Sat Jul 31, 2010 2:50 pm
by rdonnay
Tom -

Was this problem ever resolved for you?
I just discovered that tipblocks do not work correctly when using the DCBROWSE .. DESCENDING clause.

Roger