On Thu, 17 Apr 2008, Szakáts Viktor wrote:
Hi Viktor,
> I did some tests using rto_tb.prg, pls. find the fixes
> applied to tbrowse.prg attached.
Thank you,
> Shortly:
> - ::freeze return value on assign made compatible
> when numeric, but out of range value was assigned.
To be precis it should return INT( nColumns ) - I'll fix it.
> - ::colSep, ::headSep, ::footSep, ::skipBlock,
> ::goTopBlock, ::goBottomBlock SETGETs added to
> replicate exact CA-Cl*pper behaviour. This way
> type checking is done by _eInstVar() instead of
> the class engine.
Yes this will make error messages compatible with Clipper.
Though I'd like to keep type spec in this ivars. It's not
necessary to remove it and it may be usable in the future.
> There are just three unexplained differences (amazing BTW)
> when comparing the C53 and Harbour output of rto_tb.prg;
> value of o:rowPos, where it is 2 in C53 and 1 in
> Harbour after calls in line 214 (and 215, 216).
> This is actually a pretty small test case there.
I'll look at it.
> One minor issue I've noticed - which doesn't affect actual
> functionality, AFAICS - is if you use BROWSE()
> and you keep <PgDn> pressed on the first row, or <PgUp>
> pressed on the last row, on a long database, you may notice
> that the non-stable rows are being "scrolled" until the browse
> gets enough time to stabilize (or you reach the other end
> of the table). I can't really describe this in better words,
> but you may see it if you compare C5x and Harbour in the above
> situation. Probably just cosmetic stuff or some internal side
> effect (or me seeing ghosts :).
I did it and Clipper makes the same. I'm attaching a little bit
modified example which have delay in skip block to illustrate it.
Try it in Clipper and new TBrowse code. You will see that old
rows are shown they will not be overload. There is also one small
difference in scrolling which I should fix. CA-Clipper sets default
color to TBrowse colors so it's not the empty area after scrolling
is field with standard TBrowse color (W+/R) and in new code it's
default color (W/N). I'll change it. In this test you can also see
two things I haven't replicated intentionally.
1-st is missing protection against invalidating row buffer when
view are decrease during working. Run the test, wait a while for
stabilization and then thi SPACE to decrease number of rows to 6
and PGDN to see what CL53 will do. As you can see the unexisting
rows are still visible and as long as you will not jump to top
or bottom TBrowse will not refresh them.
2-nd is sth what I do not understand. Looks like some typo or
unfinished code to detect some changes. Only CL53 does it and
makes it regularly in all my tests. Run the test, wait for
stabilization and look at value in col2 row5. It will be 5 at
startup. Then make any operation which will force header redrowing,
f.e. freeze some column using 0,1,2,3 or move left/right to force
horizontal scrolling. You will see that all such operation causes
that CL53 moves to row 5 and reload it and then moves back to previous
position. CL52 does not make anything like that. I do not know what it
is and why it does it. It looks like some internal TBrowse code
invalidate unintentionally this row and tbrowse has to refresh it.
CL53 alwys make it and the refreshed row number may change depending
on the rowcount and it's about rowcount / 3 + 1. Maybe I'm wrong but
it looks for me like unintentional overloading memory byte where
status of row is hold what makes it invalid.
At the beginning I thought that it may be some type of changes detecting
for automatic refreshing but it does not help in the trick with SPACE
in this tests - change in source code the reduced rowcount to 3 and you
will see that only the row 5 is invalidated.
I do not plan to replicate it but please remember about it in TBrowse
tests. This may cause some unpredictable results.
> I'll continue to do some more tests.
Thank you very much.
best regards,
Przemek
#include "inkey.ch"
#include "button.ch"
#include "setcurs.ch"
#include "box.ch"
proc main()
static s_nCount := 0
static s_nPos := 1
static s_nSize := 100
local nTop, nLeft, nBottom, nRight
local cColor
local oBrw, oCol1, oCol2, oCol3, oCol4, oCol5
local nKey, nCol
nTop := 2
nLeft := 10
nBottom := 20
nRight := 70
cColor := "W+/R,G+/BR,RG+/B,BG+/G,N/GR,GR+/BG,B/GR*"
set date format to "yyyy/mm/dd"
// enable mouse events in CL53/Harbour
set( _SET_EVENTMASK, INKEY_ALL )
mSetCursor( .t. )
cls
dispBox( nTop, nLeft, nBottom, nRight, B_DOUBLE_SINGLE, cColor )
dispOutAt( nTop + 3, nLeft, "Ă", cColor )
dispOutAt( nTop + 3, nRight, "´", cColor )
dispOutAt( nBottom - 2, nLeft, "Ă", cColor )
dispOutAt( nBottom - 2, nRight, "´", cColor )
oBrw := tbrowseNew( nTop + 1, nLeft + 1, nBottom - 1, nRight - 1 )
oBrw:colorSpec( cColor )
oBrw:headSep := "ż ÚÄ"
oBrw:footSep := "Ů ŔÄ"
oBrw:colSep := "ł ł"
oBrw:SkipBlock := { | n | delay(0.2), ;
n := iif( n < 0, max( n, 1 - s_nPos ), ;
min( s_nSize - s_nPos, n ) ), ;
s_nPos += n, n }
oBrw:GoTopBlock := { || s_nPos := 1 }
oBrw:GoBottomBlock := { || s_nPos := s_nSize }
oCol1 := tbColumnNew( "COL;1;", {|| s_nPos } )
oCol1:defColor := { 2, 1, 3, 4 }
oCol1:footing := "position"
oCol1:colorBlock := {|val| { val % 5 + 1, val % 3 + 2 } }
oCol2 := tbColumnNew( "COL;2", {|| s_nCount++ } )
oCol2:defColor := { 3, 4, 5, 6 }
oCol2:footing := "counter"
oCol2:headSep := "ż ÚÄ´HIDEĂÄ"
oCol3 := tbColumnNew( "COL 3", {|| s_nPos % 3 == 0 } )
oCol3:defColor := { 5, 6, 2, 3 }
oCol3:footing := "logical"
oCol3:picture := "@YR [Y]" // Clipper wrongly calculate the size here
oCol3:headSep := "ˇ ÖÄ´HIDEĂÄ"
oCol3:footSep := "˝ ÓÄ"
oCol3:colSep := "ş ş"
oCol4 := tbColumnNew( " SHOW; ALL", {|| date() - s_nPos} )
oCol4:defColor := { 6, 3, 4, 2 }
oCol4:footing := "date"
oCol5 := tbColumnNew( "COL;5", {|| VERSION() } )
oCol5:defColor := { 6, 3, 4, 2 }
oCol5:footing := "string"
oCol5:width := 20
oBrw:addColumn( oCol1 )
oBrw:addColumn( oCol2 )
oBrw:addColumn( oCol3 )
oBrw:addColumn( oCol4 )
oBrw:addColumn( oCol5 )
// start at bottom
// oBrw:goBottom()
while .T.
while !oBrw:stabilize() .and. nextkey()==0
enddo
nKey := inkey( 0 )
if nKey == K_ESC
exit
elseif nKey == K_SPACE
s_nSize := 6
elseif nKey == K_INS
oBrw:colorRect( { oBrw:rowPos, 1, oBrw:rowPos, 4 }, { 7, 6 } )
elseif nKey == K_DEL
oBrw:refreshCurrent()
elseif nKey >= ASC( "0" ) .AND. nKey <= ASC( "3" )
oBrw:freeze := nKey - ASC( "0" )
elseif nKey == K_LBUTTONDOWN .and. ;
oBrw:hitTest(mRow(),mCol()) == HTHEADSEP .and. ;
( ( nCol := oBrw:mColPos ) == 2 .or. nCol == 3 )
if nCol == 2
oCol2:width := 0
else
oCol3:width := 0
endif
oBrw:configure()
elseif nKey == K_LBUTTONDOWN .and. ;
oBrw:hitTest(mRow(),mCol()) == HTHEADING .and. ;
oBrw:mColPos == 4
oCol2:width := 10
oCol3:width := 7
oBrw:configure()
else
oBrw:applyKey( nKey )
endif
enddo
return
proc delay(n)
n+=seconds()
while seconds()<n; enddo
return
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour