Page 1 of 1

DCBROWSE ... FIT improvement

Posted: Sat Jul 02, 2011 10:40 am
by jdsoft
Hello Express++ users.

If there is a DCBROWSE … FIT with multiple columns, clicking in the most left or right field causes the whole browse to shift slightly left or right.
I noticed this for quite some time, but I accepted it as a “feature”.
The same issue arises if you have a horizontal scrollbar, you can shift the scrollbar, even if there is only 2 or 3 small columns.
You can observe this behaviour in xdemo, “Samples 1\ArrayBrow”.

Until one of my customers that uses DCBROWSE extensively for data entry told me he was getting irritated by that restless data-entry window. Today I found time to investigate, and found that the fix is amazingly simple, and it took me only 15 minutes to locate. Should have done this before……
The scrollbar width in Win-7 seems to be 17 pixels, and not 15.

Current code in _dc_dcgetbx.prg (arround line 3100 in my code build 255)

Code: Select all

   FOR j := 1 TO Len(aTokens)
      IF aTokens[j]:isDerivedFrom('XbpScrollBar') .AND. ;
         aTokens[j]:type == XBPSCROLL_VERTICAL
         nWidth += 15
      ENDIF
   NEXT
Change it to:

Code: Select all

   FOR j := 1 TO Len(aTokens)
      IF aTokens[j]:isDerivedFrom('XbpScrollBar') .AND. ;
         aTokens[j]:type == XBPSCROLL_VERTICAL
         //
         // J. Duijf 02-07-2011
         // More accurate width of vertical scroll-bar
         // Prevent shifting columns when clicking left/right column
         // nWidth += 15
         //
         nWidth += aTokens[j]:CurrentSize()[1]
      ENDIF
   NEXT
You can change the code, and recompile without any risk. This "shifting" behaviour is gone now.
However: All DCBROWSE get 2 pixels wider then before.

Regards,
Jack Duijf

Re: DCBROWSE ... FIT improvement

Posted: Sun Jul 03, 2011 12:48 am
by Wolfgang Ciriack
Hello Jack,
thanks for this solution, i saw this behavior for a long time and i am happy for this cosmetic correction.