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!

PUSH KEY & PUSH KEY CLEAR 2

Status
Not open for further replies.

sohrab100

Programmer
Jan 18, 2002
56
HK
What is the difference of it?

Let's take an example...

Previous State

Key Action
F1 Help()
F2 Save()

When Issuing
1. PUSH KEY
2. PUSH KEY CLEAR

On Key label F1 Help2()
On Key Label F2 Save2()

What is the Current State

And After that,issuing

POP KEY

Then what is the state of now? I means the stack of key assignment.

sohrab100
 
sohrab100,


Key Action
F1 Help()
F2 Save()

When Issuing
1. PUSH KEY
2. PUSH KEY CLEAR

On Key label F1 Help2()
On Key Label F2 Save2()
What is the Current State

Key Action
F1 Help2()
F2 Save2()
But why you need to push twice ?


And After that,issuing
POP KEY
Then what is the state of now? I means the stack of key assignment.


Key Action
F1 Help()
F2 Save()

But you still have one more stack to POP from the last time you PUSH

Hope it helps a bit

-- AirCon --
 
Hi

PUSH KEY... clears the actual key assignments made to a stack and the programme or methods forget the existense of such KEY LABEL definitions.

In such circumstances, POP KEY will restore those stack back into effective existence.

PUSH KEY CLEAR... CLEAR is an option to PUSH KEY in that all the KEYS are cleared from memory stacks as well. SO POP KEY cannot bring it back to existence.

It is like telling..
ON KEY LABEL F1
ON KEY LABEL F2
ON KEY LABEL F3
instead..
PUSH KEY CLEAR.. single line of code will clear all the KEYS. The individual command helps to selectively drop the KEY LABELs defined.

It is easier to use PUSH KEY when a called such function is executed..

Foe example..
ON KEY LABEL F2 DO myF2
ON KEY LABEL F3 DO myF3

Now if F2 is pressed and then while you are within myF2 function, if the user again presses F2, a sort of cyclical calls will take place. To avoid it, in myF2, the first line of code should be..
PUSH KEY
.. my other code..
.. last line of code is..
POP KEY

:)



____________________________________________
Ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
Ramani,

PUSH KEY CLEAR... CLEAR is an option to PUSH KEY in that all the KEYS are cleared from memory stacks as well. SO POP KEY cannot bring it back to existence

I guess you misunderstand about the stack.
The different of using CLEAR options is, whether we want to bring every key that has been assigned, onto the next stack or not.

"PUSH KEY" with or without clear will always corresponding with "POP KEY". It means that pop key will always revert to the original conditions.

Try this in your command window (assumed that F1 key is assigned to VFP help / default)
Notes: press F1 key for each code to see the result

------------
On key label F1 ?'test'

push key && 1 PUSH
pop key && 1 POP

push key clear && 1 PUSH
pop key && 1 POP
-------------

After the last code, if you press F1 you will get 'test' shown on VFP screen

-- AirCon --
 
Hi

gggggzzzzzzzz...

PUSH KEY only keeps a copy of all the current ON KEY LABELS into a stack.
PUSH KEY CLEAR drops the current active KEY LABELS.

POP KEY brings them back into effect replacing the ones if any that exists with the same name.

That is a lot different to what I wrote. Thanks Aircon. Star to you.

I committed the mistake, since it is almost NIL that I use these functions.

The forms interactive and key press events do the work more effectively and I alomost never use the PUSH KEY or POP KEY commands. Those were until DOS 2.6 days.

Star to you for bringing back the memories. :)

:)


____________________________________________
Ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
Aha!!

Thanks a lot. A star from Top Experts

[afro2]
Regards

-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top