Current Column in Browser

Jenie888

Member
I need to find the current column in a browser.

I know I can get the current column by getting the handle, but that is on when you click on the column label.
DEFINE VARIABLE h-Column AS HANDLE NO-UNDO.
h-Column = br-test:CURRENT-COLUMN.

Is there a way of getting the current column that hte user clicked on, if they click on a row, instead of the label?

Thanks,
Jenifer
 
This isn't really supported by the Progress browser, but you can get something like it by being a bit sneaky! Try the following code. The handle SELF within the inner DO block provides a handle to the clicked column. I've used it in this instance to toggle the cell font between normal and bold:

ON 'ENTRY':U OF BROWSE BROWSE-1 ANYWHERE
DO:
DEF VAR hLast AS HANDLE NO-UNDO.

IF SELF:HANDLE <> BROWSE BROWSE-1:HANDLE THEN
DO:
ASSIGN hLast = LAST-EVENT:WIDGET-LEAVE.

IF VALID-HANDLE(hLast) THEN
DO:
SELF:READ-ONLY = TRUE.
APPLY "ENTRY" TO hLast.
SELF:READ-ONLY = FALSE.

SELF:FONT = IF SELF:FONT = ? THEN 6 ELSE ?.


RETURN NO-APPLY.
END.
END.
END.

but in order for this to work there are a couple of caveats.

1. The browser will never receive focus so you can't scroll up and down using the keyboard.

2. All browser columns must be enabled for input (but the trigger above stops the cell from receiving input focus just in time).

3. Another widget (not the browser) must have focus when the form is first displayed.

Apart from that, it seems to do roughly what you want, although you could probably refine it a little. For example, you may need to set the browser READ-ONLY attribute to true if the user tabs into the browser using the keyboard. And set it false if the user clicks into the browser using the mouse.

HTH
 
Thanks! I will check this out.


Mike Carroll said:
This isn't really supported by the Progress browser, but you can get something like it by being a bit sneaky! Try the following code. The handle SELF within the inner DO block provides a handle to the clicked column. I've used it in this instance to toggle the cell font between normal and bold:

ON 'ENTRY':U OF BROWSE BROWSE-1 ANYWHERE
DO:
DEF VAR hLast AS HANDLE NO-UNDO.

IF SELF:HANDLE <> BROWSE BROWSE-1:HANDLE THEN
DO:
ASSIGN hLast = LAST-EVENT:WIDGET-LEAVE.

IF VALID-HANDLE(hLast) THEN
DO:
SELF:READ-ONLY = TRUE.
APPLY "ENTRY" TO hLast.
SELF:READ-ONLY = FALSE.

SELF:FONT = IF SELF:FONT = ? THEN 6 ELSE ?.


RETURN NO-APPLY.
END.
END.
END.

but in order for this to work there are a couple of caveats.

1. The browser will never receive focus so you can't scroll up and down using the keyboard.

2. All browser columns must be enabled for input (but the trigger above stops the cell from receiving input focus just in time).

3. Another widget (not the browser) must have focus when the form is first displayed.

Apart from that, it seems to do roughly what you want, although you could probably refine it a little. For example, you may need to set the browser READ-ONLY attribute to true if the user tabs into the browser using the keyboard. And set it false if the user clicks into the browser using the mouse.

HTH
 
Back
Top