DCBROWSE ... FIT improvement

This forum is for ideas and or code to be contributed for general use.
Post Reply
Message
Author
User avatar
jdsoft
Posts: 116
Joined: Thu Jan 28, 2010 1:13 pm
Location: Overberg
Contact:

DCBROWSE ... FIT improvement

#1 Post 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
Regards,
Jack Duijf

Wolfgang Ciriack
Posts: 481
Joined: Wed Jan 27, 2010 10:25 pm
Location: Berlin Germany

Re: DCBROWSE ... FIT improvement

#2 Post 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.
_______________________
Best Regards
Wolfgang

Post Reply