Simulate CTRL-Key pressed in browser

grinder

Member
Hi there,

is it possible to simulate the CTRL-Key in a browser in order to select multiple lines without using the CTRL-Key on the keyboard?
Thanks in advance.
 

Cringer

ProgressTalk.com Moderator
Staff member
What exactly are you trying to achieve, and which Progress version? Is that you want the user to left mouse click only and that adds the selected row to the selection of a multi-select browse?
 

grinder

Member
Thx for the quick reply.
I'm using OpenEdge 11.
And yes, if I got you right this is what I am trying to do.
Let me explain: I have a selection-dialog with a browser in it. In this dialog it is possible to pre-select datasets on startup, e.g. line 4, 5, 6 are pre-selected. If the user now clicks on line 2 then line 2, 4, 5, 6 are selected, just like if the CTRL-key was pressed all the time.
 

Cringer

ProgressTalk.com Moderator
Staff member
There must be a way to work this in. I can't think of it right now. If I have any bright ideas I'll post them.
 

D.Cook

Member
I think this used to be the default behaviour (V8).
You might be able to store a list of currently selected options (sounds like you already do for the pre-selection), then use the function SELECT-ROW() to re-select all options every time the user clicks on the browse.

Or, you may be able to override the browse mouse click event like this:
On the mouse click event, select the clicked row with SELECT-ROW() (this function does not deselect other rows in a multi-select browse). Then RETURN NO-APPLY to prevent the default action.

This code I've used in the past for finding the clicked row. Where SELF is the browse widget. Sorry I can't fully explain it, but I assume the 17 is the Windows scroll-bar width.
Code:
vr_row = int(truncate((last-event:y - 17) / (self:row-height-pixels + 4), 0)) + 1.

/EDIT: This code was for the right-click event which by default does not select the row clicked on. Using SELECT-FOCUSED-ROW as posted below makes a lot more sense.
 

grinder

Member
Think I got it. I put the selected items in a list (including the new selection or remove new selection from list if it was in list already) and do the following:

Code:
<browserName>:DESELECT-FOCUSED-ROW().

DO <counterVar> = 1 TO NUM-ENTRIES(<selectionListVar>):

  FIND FIRST <tableName> NO-LOCK
       WHERE <tableName>.nr = INTEGER(ENTRY(<counterVar>, <selectionListVar>))  
    NO-ERROR.

    IF AVAILABLE <tableName> THEN DO:

      REPOSITION <browserName> TO ROWID ROWID(<tableName>) NO-ERROR.
      <browserName>:SELECT-FOCUSED-ROW().

    END. 

END.

Thank you for your answers.

/EDIT: In Trigger LEFT-MOUSE-CLICK of Browser
 
Top