Widget Wait-for

Chris Kelleher

Administrator
Staff member
I just love doing graphics in Progress! This is V9.0B by the way.

I'm trying to implement a graphical copy and paste. This involves selecting
one or more widgets and then selecting the "copy" procedure we've written.
The next step involves selecting the insertion point, and that is where I'm
having some trouble.

I've currently added:

wait-for "MOUSE-SELECT-DOWN":U of frame {&FRAME-NAME}
focus frame {&FRAME-NAME}
pause 60.

and then:

if last-event:x = ? then return.
assign lIx-start-selection = last-event:x
lIy-start-selection = last-event:y.

to get the insertion point, and it works.

The problem is when the insertion point is on top of another widget. Of
course the wait-for doesn't work because the mouse-select-down event is
occurring on the widget, not the frame.

Since I don't know what widgets may be in the frame at compile time, I
cannot just add the widgets in the frame to the wait-for statement (unless
I've missed that VALUE() will work for the widget-phrase in the wait-for).

Anybody have any ideas? I just need a way to wait until the user clicks the
mouse anywhere in the frame, and then to capture the x and y coordinates for
the paste side of the problem.

--------------------------------------------
Stephen C. West-Fisher
Teams Rehabilitation Systems, Inc.
(888)734-2292 http://www.rehabware.com
--------------------------------------------
 

Chris Kelleher

Administrator
Staff member
Steve, I'm not sure why you chose to do a wait-for specifically for the
paste operation. It may be easier if you say something like:

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
/* In paste mode */
On 'mouse-select-down' of frame {&frame-name} ANYWHERE do:
/* check last-event:x, y and paste the items */
End.
[/code]

Or if you create your frame dynamically:

<BLOCKQUOTE><font size="1" face="Arial, Verdana">code:</font><HR><pre>
Create frame lh-frame-wh
Assign
Parent = lh-window-wh
Grid-visible = yes
Grid-snap = yes
Grid-unit-height-c = ... /* Set up your grid */
Triggers:
On mouse-select-click anywhere persistent
Run intp_paint_items in this-procedure. /* check last-event:x, y and
paste the items */
End.
[/code]

HTH and have fun.
---------------------------------------------------------------------
King Wong
king@consumersystems.demon.co.uk
 

Chris Kelleher

Administrator
Staff member
The reason I used the wait-for was because the first click is actually at
the end of the copy function to get a reference point to correspond to the
insertion point of the paste. But I didn't like using it, and your reply has
given me some other ideas to pursue. Thanks!

--------------------------------------------
Stephen C. West-Fisher
Teams Rehabilitation Systems, Inc.
(888)734-2292 http://www.rehabware.com
--------------------------------------------
 
Top