Consultor Eletrônico



Kbase P112810: 4GL/ABL: How to force the vertical scroll bar to appear when needed as the user modifies the row wid
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/2/2008
Status: Verified

GOAL:

4GL/ABL: How to force the vertical scroll bar to appear when needed as the user modifies the row width of a dynamic BROWSE widget?

GOAL:

How to write an "END-ROW-RESIZE" trigger for a dynamic BROWSE widget?

GOAL:

How to write an "START-ROW-RESIZE" trigger for a dynamic BROWSE widget?

FACT(s) (Environment):

Windows
Progress 8.x
Progress 9.x
OpenEdge 10.x

FIX:

To force the vertical scroll bar to appear when needed as the user resizes the row height of a dynamic BROWSE, define an "END-ROW-RESIZE" trigger to simulate the pressing down of the "DOWN ARROW" and "UP ARROW" keys respectively. For example, the following procedure creates a dynamic browse:
PROCEDURE createBrowse:
ASSIGN
hFrame = FRAME DEFAULT-FRAME:HANDLE
hQuery = QUERY qCustomer:HANDLE.

CREATE BROWSE hBrowse
ASSIGN
TITLE = "Dynamic Browse"
FRAME = hFrame
QUERY = hQuery
X = 2
Y = 2
WIDTH = 74
DOWN = 10
VISIBLE = YES
SENSITIVE = TRUE
READ-ONLY = NO
ROW-RESIZABLE = TRUE
SCROLLBAR-VERTICAL = TRUE
TRIGGERS:
ON 'END-ROW-RESIZE' PERSISTENT RUN ForceVerticalScrollBar IN THIS-PROCEDURE.
END TRIGGERS.

OPEN QUERY qCustomer FOR EACH Customer NO-LOCK WHERE CustNum < 7.
hColumn = hBrowse:ADD-LIKE-COLUMN("Customer.CustNum").
hColumn = hBrowse:ADD-LIKE-COLUMN("Customer.Name").
hColumn = hBrowse:ADD-LIKE-COLUMN("Customer.Balance").
END PROCEDURE.
Where the internal procedure referenced in the END-ROW-RESIZE trigger is defined as:
PROCEDURE ForceVerticalScrollBar:
/* Simulate user prtessing the down arrow key */
APPLY "CURSOR-DOWN" TO hBrowse.
/* Simulate user prtessing the up arrow key */
APPLY "CURSOR-UP" TO hBrowse.
END PROCEDURE.
To write a 'START-ROW-RESIZE' trigger for a dynamic browse, follow the same syntax used in defining the 'END-ROW-RESIZE' of the above dynamic BROWSE widget. For example the following CREATE BROWSE statement defines both these events:
CREATE BROWSE hBrowse
ASSIGN
TITLE = "Dynamic Browse"
FRAME = hFrame
QUERY = hQuery
X = 2
Y = 2
WIDTH = 74
DOWN = 10
VISIBLE = YES
SENSITIVE = TRUE
&.nbsp; READ-ONLY = NO
ROW-RESIZABLE = TRUE
SCROLLBAR-VERTICAL = TRUE
TRIGGERS:
ON 'START-ROW-RESIZE' PERSISTENT RUN CodeToExecuteOnStartRowResizeEvent IN THIS-PROCEDURE.
ON 'END-ROW-RESIZE' PERSISTENT RUN CodeToExecuteOnEndRowResizeEvent IN THIS-PROCEDURE.
END TRIGGERS.
Where CodeToExecuteOnStartRowResizeEvent and CodeToExecuteOnEndRowResizeEvent are internal or external procedures that include the code to execute at these two events respectively. .