Consultor Eletrônico



Kbase P35754: How to hide the vertical or horizontal scrollbar on a frame?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   11/25/2004
Status: Verified

GOAL:

How to hide the vertical or horizontal scrollbar on a frame?

GOAL:

How to control the scrollbars in a frame independently ?

FACT(s) (Environment):

Windows

FIX:

A scrollable Progress frame will get both horizontal and vertical scrollbars if a widget is placed in the frame outside of the current viewport. This may not always be desirable - If only vertical scrolling is required, the horizontal scrollbar will often be seen as unnecessary clutter.

The 4GL does not provide direct control over which scrollbars are visible, however this can be achieved indirectly by using the appropriate Windows API as demonstrated by the following code:

/* Scrollbars.p
Shows independent control horizontal and vertical scrollbars in a frame
using Windows API calls */

/* example call */
DEFINE VARIABLE cTest AS CHARACTER NO-UNDO.
DISPLAY SPACE(6) cTest SPACE(6) WITH FRAME f1 THREE-D.

RUN ShowScrollBars(FRAME f1:HANDLE, NO, YES).

WAIT-FOR GO OF THIS-PROCEDURE.

/* 4GL wrapper procedure for ease of use */
PROCEDURE ShowScrollbars:
DEFINE INPUT PARAMETER ip-Frame AS HANDLE NO-UNDO.
DEFINE INPUT PARAMETER ip-horizontal AS LOGICAL NO-UNDO.
DEFINE INPUT PARAMETER ip-vertical AS LOGICAL NO-UNDO.

DEFINE VARIABLE iv-retint AS INTEGER NO-UNDO.

&scoped-define SB_HORZ 0
&scoped-define SB_VERT 1
&scoped-define SB_BOTH 3
&scoped-define SB_THUMBPOSITION 4

RUN ShowScrollBar ( ip-Frame:HWND,
{&SB_HORZ},
IF ip-horizontal THEN -1 ELSE 0,
OUTPUT iv-retint ).

RUN ShowScrollBar ( ip-Frame:HWND,
{&SB_VERT},
IF ip-vertical THEN -1 ELSE 0,
OUTPUT iv-retint ).
&undefine SB_HORZ
&undefine SB_VERT
&undefine SB_BOTH
&undefine SB_THUMBPOSITION
END PROCEDURE.

/* Windows API entry point */
PROCEDURE ShowScrollBar EXTERNAL "user32":
DEFINE INPUT PARAMETER hwnd AS LONG.
DEFINE INPUT PARAMETER fnBar AS LONG.
DEFINE INPUT PARAMETER fShow AS LONG.
DEFINE RETURN PARAMETER ReturnValue AS LONG.
END PROCEDURE.