Page 1 of 1

TSBrowse with one dimensional array

Posted: Wed Aug 01, 2007 7:38 pm
by TimStone
I have been working with TSBrowse ... and its very nice. However, I discovered a problem. If I browse a multi-dimensional array, no problem. However, when I browse a single dimensional array, it only displays the first letter of the column. Here is a sample that reproduces the problem. Is anyone working with TSBrowse, and do you have any thoughts on this ?

Tim

// Test TSBrowse with a single array element
#INCLUDE "fivewin.CH"
#INCLUDE "tsbrowse.CH"

PROCEDURE main

LOCAL aItm := { }
AADD( aItm, "This is text to test on line 1")
AADD( aItm, "This is text to test on line 2")
AADD( aItm, "This is text to test on line 3")
AADD( aItm, "This is text to test on line 4")
AADD( aItm, "This is text to test on line 5")
AADD( aItm, "This is text to test on line 6")
AADD( aItm, "This is text to test on line 7")
AADD( aItm, "This is text to test on line 8")
AADD( aItm, "This is text to test on line 9")
AADD( aItm, "This is text to test on line 10")
AADD( aItm, "This is text to test on line 11")

DEFINE DIALOG oDlg FROM 100,50 TO 400, 500 PIXEL Title "TSBrowse One Directional Array"

@ 0,0 BROWSE oLbx SIZE 600, 150 PIXEL OF oDlg

oLbx:setArray( aItm )

ADD COLUMN TO BROWSE oLbx DATA ARRAY ELEMENT 1 HEADER "Details" SIZE 400 ALIGN 0,1

oLbx:nLineStyle:=0
oLbx:nHeightCell += 4
oLbx:nHeightHead += 6
oLbx:lNoHScroll := .T.


// Activate the dialog screen
ACTIVATE DIALOG oDlg

RETURN NIL
:?

Posted: Wed Aug 01, 2007 11:08 pm
by James Bott
Tim,

After looking at the TSBrowse code and the syntax of defining a column for an array, I don't think TSBrowse was designed to handle a single dimension array.

Note that you can define your array like this:

AADD( aItm, {"This is text to test on line 1"})

and TSBrowse works correctly. It is expecting each element of the array to contain an array.

James

That works ... but ...

Posted: Wed Aug 01, 2007 11:24 pm
by TimStone
That works and its an easy fix.

Here is one other interesting observation. When browsing a file, the highlight only extends for the number of columns on the browse ... so if the right side has an empty column ( space ), the browse bar does not extend into it. In all other browses the highlight goes into "non-programmed" space.

Thoughts ?

Tim

Posted: Wed Aug 01, 2007 11:28 pm
by James Bott
Tim,

>so if the right side has an empty column ( space ), the browse bar does not extend into it.

I noticed that too. I just either widen the colum to fit the browse, or add a dummy column to fill the extra space.

James

Highlight

Posted: Wed Aug 01, 2007 11:47 pm
by TimStone
I'm doing the same thing, but it is a "fixable" component I'm sure. The color bars, BTW, go all the way across.

Posted: Thu Aug 02, 2007 7:38 am
by StefanHaupt
Look at this instance variable:

Code: Select all

DATA   nAdjColumn    AS NUMERIC     // column expands to flush table window right
oBrw:nAdjColunm := <most-right-column>

Posted: Thu Aug 02, 2007 2:36 pm
by James Bott
Stefan,

>DATA nAdjColumn

I see that has the same effect as increasing the column width specification in the column definition.

I have also modifed TSBrowse to display the highlight bar all the way across even if there is a "phantom" column on the right. This will be in the next release.

Unfortunately, TSBrowse's documentation is incomplete, so we have to learn how to use it either by trial and error or by getting tips like yours.

Thanks,
James