Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Popup menus

0 views
Skip to first unread message

Paul Prescod

unread,
Nov 11, 1993, 4:04:50 PM11/11/93
to
This is code for bringing up popup-menus and (optionally) selecting an option
on them, from rexx. The most commonly asked for use for this is auto-shutdown.

This requires VX-REXX. The next version of VX-REXX will have features that
make this much easier. Without further ado:

popup_demo.vrm

/*
VX-REXX Popup menu demo. (requires VX-REXX)

This program queries the user for the name of a folder that is already open,
pops up it's popup menu, and sends keystrokes to it. It uses a function
called "popup windowname, key."

So to do an automatic shutdown, you would do "call popup Desktop, d"

Notes:

The next patch for VX-REXX will have some features that make this much easier.

If you wanted to add to this so it didn't require the folder to be open, you
could use SysSetObject (but that's another lesson) You could also do it with
keystroke pushing.


*/


popup_demo:
windowname = "Desktop" /* Default Values */
key = "d"

/* to shutdown the desktop, take out the next two lines */

id = VRPrompt( VRWindow(),"Folder to display popup for?",,
"windowname", "Folder to popup?", , , )
id = VRPrompt( VRWindow(), "Key to send", "key", "Key?" )

call popup windowname,key

return

/* Popup: Takes the name of an open folder and a series
of keystrokes to send to it's popup menu
*/

popup:procedure
parse arg windowname,key

call VRMethod "Application","ListWindows","Windows."

do x=1
handle=word(windows.x,1)
caption=VRGet(handle,"Caption")
if caption=windowname then leave
if x=windows.0 then do /* not in windowlist!! */
id = VRMessage( VRWindow(), "Window not found: "||windowname||,
". Case is sensitive and folder must be open.",,
"Huh?", "Error", , , )
return
end
end

/* We can only work with handles, not window names */

ok=VRMethod("Application","SendKeyString",handle,"{Ctrl}\")
ok=VRMethod("Application","SendKeyString",handle,"{Shift}{F10}")

Desktop=GetDesktop(handle)
popup=GetPopup(desktop)

ok=VRMethod("Application","SendKeyString",popup,key)
return

/* GetDesktop: Finds the "grandparent" of all window
objects, the desktop.
*/


GetDesktop:procedure
parse arg parent

do while parent<>""
parent=VRGet(parent,"Parent")
end
return parent

/* Get Popup: Finds the first child of the desktop, which
is always any open popup menu (since it is
on top
*/

GetPopup:arg desktop
return VRGet(parent,"FirstChild")

0 new messages