Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 9 Edit Box ScrollBars not showing up 1

Status
Not open for further replies.

CBellucci

Programmer
Apr 20, 2007
38
US
This should be simple, but it isn't. I dropped an Edit Box on a form, made a CURSOR Memo Field the control. Size of the Edit Box is about 2 lines. I want the ScrollBars to show, but they just won't, even if ScrollBars = 2. I've played with Themes .T. and Themes .F.

What am I doing wrong? I know is is a smack my head moment, but I can't see it.
 
Sorry if this is obvious, but does the text actually exceed two lines? If not (and especially if the box is empty), the scroll bars won't be active. They will be visible, but will appear greyed out.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I've just done a quick test, and can reproduce what you are seeing. If the editbox is less than about 36 pixels high (two lines of text?), the vertical scrollbar does not appear. I suspect that this is by design. It would be difficult to paint the scrollbars in such a confined space.

The solution is simply to make the box a little bit taller.

Edit: the cut-off point seems to be 38 pixels.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Well, I had found where someone had a similar problem and claimed the height needed to be at least 34 pixels. So I made mine 37 pixels. However, when I grabbed the bottom of the box on the Edit Box control and pulled it down, it settled at 53 pixels and showed the ScrollBars even in editing the form.

I suspect it has something to do with the width as well. The Edit Box I've got is 658 pixels wide. But now I know if the ScrollBars don't show when editing the form, they won't show in the program. I also don't seem to be able to type in a Height number and have it keep. The box readjusts to whatever I set it by drag and drop before.

Thank you so much!
 
I don't think there is any fixed value for minimum height. As far as I see when using SHIFT+UP and SHIFT+DOWN to resize the scrollbar appears exacly when the two arrow buttons/icons are fitting the hight.
And their height is not varying with font size, but with scaling factor set in Windows properties. And may also depend on Windows itself, what arrow icons it draws for scrollbars. They have a uniform look not defined by VFP. So that minimum likely varies with OS version and scale setting.

For me, the scrollbar icons appear at 39 pixels height on Win10 with 100% scaling. I need to test how scaling changes that, but it's clearly the visibility of the two up and down scrollbar buttons, that turns the scrollbar on and off and I would need to err, if the font scaling of Windows does not also affect certain system metrics like scrollbar width and so also button sizes. SYSMETRIC(6), which says it's for the height speaks for 2*17=34, but that it's 39 - odd - speaks for adding in more things to draw, there is the line surrounding the Editbox itself in Windows 10 flat control look that is only 1 pixel, in Win95-xp it was a 3d look that took 2 pixels. The middle line between the buttons is perhaps shared, there you have a reason the value can be odd.

Just by the way, the VFP Sysmetric() function only provides some system measurements, the Windows API call GetSystemMetrics offers more. This function could not only give varying results in different windows version because of 3d and flat look and scaling, the formula for minimum vertical scrollbar height could differ depending on how controls are defined with their frame or not. You can, for example, turn themes off and decide for flat or 3d look of controls. And yes, then it changes from 39 to 37 in flat look. So it has to do with more than one system metric and it even depends whether VFP uses the system flat look (with themes turned off) or it's own flat look. They all differ. What stays constant is the condition the scrollbar buttons can appear both, fully. So there will be no simple final formula and you better use a rough thing like 3*sysmetric(6), enough height to draw two buttons and whatever additional pix3els to fiddle with surrounding lines of the scrollbar buttons, the scrollbar itself and the control. Also, because the control height is including the control frame, it's not an inner canvas height.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top