Window Scrollbar Is Too Wide and Obscures Data

Patrick Roth - Click for blog homepageThis is a reposting of an article Patrick Roth originally wrote on my Developing for Dynamics GP blog.

A customer recently ran across an oddity on several (but not all) of their new Windows 7 machines.  The previous Windows XP machines being replaced were OK.

The issue was that on windows with scrolling windows, they noticed that the rightmost fields were partially obscured by the scrolling window scrollbar.

The screenshot below shows the issue in Sales Transaction Entry.

We can clearly see that the hundredths digit is fully obscured as well as about one half of the tenths digit.

Looking more closely (and I’ll admit that I didn’t as the users didn’t complain about it!), we can see that the menu items are also larger than normal.  Had I noticed that I might have thought about this previous article and I could have saved myself a bit of research.  But then again the symptoms were not exact and either way I wouldn’t have discovered this item of interest.

We might have assumed that the value is hard coded – but since we can see the scrollbar size is changed then obviously not.

So the question is, what determines how wide a scrollbar is drawn by Dexterity?

Like many of the settings of the GP UI, we ask Windows.  To get the scrollbar width value by using the GetSystemMetrics API function and passing it SM_CXVSCROLL.

By running the C# code snippet below, I determined that my setting (and apparently the default size for most) for this metric is 17.

C# Code Example

public class PlatformInvokeTest 
{
  [DllImport("user32.dll")] 

  public static extern int GetSystemMetrics(int nIndex); 
}

int i; 
i = PlatformInvokeTest.GetSystemMetrics(2);

So what can affect this?

Our old friend the adjust Display window in Windows 7.

When we checked this setting on the affected machines, some users had apparently changed this to the 125% & 150% values.

By changing this back to 100%, the issue was resolved.  So not exactly like the issue David details in the referenced blog post but in the ballpark.

So problem solved.

But thinking about it, what if I really wanted my Display set to 125 or 150% value for other reasons?  Is there any way to do this and not obscure my decimals?

As it turns out – yes.

After the Dexterity code gets the setting for the scrollbar using the referenced API call, it then checks the Dex.ini to see if there is an entry:

MaxSWScrollbarSize=XX

This value is the maximum size of the scrollbar desired and the Windows metric value returned is capped to that value.

So by adding the setting to the dex.ini:

MaxSWScrollbarSize=17

and relaunching Dynamics, my scrollbar is now more familiar looking.

Cheers,

Patrick Roth
Sr. Escalation Engineer

This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on http://www.winthropdc.com/blog.

4 thoughts on “Window Scrollbar Is Too Wide and Obscures Data

  1. Nice post! Really informative! Now, if only we could really get a [complete] list of all those obsucure dex.ini keys…
    MG.-
    Mariano Gomez, MVP

    Like

Please post feedback or comments

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.