Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

keyboard '{escape}' command problem

Status
Not open for further replies.

codetyko

Programmer
May 26, 2001
73
MY
I have the following setup in one of my modules:

1) Screen A opens and have a command button to open up a modal Screen B.

2) Screen B acts as a modification window for a memo field (From Screen A) where upon modification, the memo field will be saved to a variable m.det1. Upon pressing the Esc button, Screen B closes and the value of m.det1 will replace the value that was originally 'imported' from Screen A.

The question:

I want to automatically close Screen B (without pressing the Esc Key on the Keyboard) upon the clicking of a save command button on Screen B.

I have tried the following but to no avail:

1) RELEASE WINDOW WONTOP() or RELEASE WINDOW 'ScreenB' with the following error message: 'Window has not been defined' despite the window name has been defined earlier in the spr program.

2) I put KEYBOARD '{esc}' at the end of the valid code of the save command button but instead of exiting the screen I get an error message "INTERRUPTED" "Cancel Ignore"

Any suggestion would be appreciated. Thanks in advance.
 
HI
I hope you are using.. MODI MEMO IN WINDOW myWindowB

if that is the case...
YOu can stuff the keyboard with Ctrl+W ...
i.e. KEYBOARD CHR(23)

This will take care of the requirement. Hope this helps :)
ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
hi ramani

no, i do not use modify memo. The memo fields I am editing comes from .txt files I saved earlier, retrieved and subsequently inserted into a temporary table for editing.

Upon modification, the memo field will be used and then stored back as a .txt file. I did this to avoid data loss if there is a corruption of the fpt file. The memo fields concerned are paragraphs keyed in by the user and can be reused for other records without having to key in the same paragraph again.

Therefore, upon completion of this task by clicking on the save command button, I just want to exit the screen without having to press the esc key manually. Using clear read will erase the previous value stored from screen B.

Hope this clears the situation.
 
codetyko,

If you are editing a memo field (yourmemofield), you don't need to store it into a variable (m.det1), unless you consider a "Cancel" buttom in Screen B. If you have only "Save" option in Screen B, just edit yourmemofield in an Editting Region. Then you can "clear read" to close the window.

On the contrary, if you want to add a "Cancel" button (good practice) to consider volatile user decitions, initialize m.det1 in Screen A (m.det1 = yourmemofield) and then edit m.det1 in Screen B (again in an Edditing Region). Then for the valid snippet of the array of buttons, you can issue:
IF m.option = 1 && user choose "Save"
REPLACE yourmemofield WITH m.det1
ENDIF
CLEAR READ
As is possible the user enters Screen B again and again (you know users!), I suggest you to initialize m.det1 in the valid snippet of the buttom which invokes Screen B.

Hope this helps!

David.
 
Codetyko,
although it is probably off time, i recommend add line
SET ESCAPE OFF
to prevent user cancel your program..
 
Click the "Terminate READ on selection" checkbox in the Save command button's dialog.

Dave S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top