Hi Daniel,
As I remeber right from my old DOS days 27 means ESC Key is pressed.
I do mostly the same excepted that I have the code in MouseDown and not MouseUp. (I do not remeber why the code is in MouseDown. It is years old and it my be a problem similar to yours).
It is simple as:
LPARAMETERS;
tnButton,;
tnSHIFT,;
tnX,;
tnY
WITH THIS
.goCurrentNode = .AktNode(tnX,tnY)
IF !ISNULL(.goCurrentNode) THEN
DO CASE
CASE tnButton=1
.goCurrentNode.SELECTED = True
.goDragedNode = .goCurrentNode
CASE tnButton=2
.NodeRightClick(.goCurrentNode)
CASE tnButton=4
.NodeMiddleClick(.goCurrentNode)
ENDCASE
ELSE
.goCurrentNode = .SELECTEDITEM
DO CASE
CASE tnButton=2
.TreeRightClick()
CASE tnButton=4
.TreeMiddleClick()
ENDCASE
ENDIF
ENDWITH
This is right out of my tree class, you can see that I use certain properties and methods you will not need.
Ahhh - there we go with your pressed key. ::)
A code snippet out of trees
KeyDown event:
LPARAMETERS;
tnKeyCode,;
tnShift
WITH THIS
DO CASE
CASE tnKeyCode=16 AND tnShift=1
CASE tnKeyCode=27 AND tnShift=0
NODEFAULT
CASE tnKeyCode=121
IF !ISNULL(.SELECTEDITEM) THEN
.NodeRightClick(.SELECTEDITEM)
ELSE
.TreeRightClick()
ENDIF
...
Do you see the NODEFAULT in the second CASE? This will clear the ESC so it does no harm.
HTH
Agnes
>Whilst using a simple TreeView connection to a Table all is fine.
>
>I decided that a side menu activated by the Right-Click,(button=2) would be
>good idea.
>
>Yes, it all worked well until testing !
>
>It was the USERs fault !
>
>They decided to simultaniously click both the Left & Right mouse button at the same time. It stop the application, and my Treeview was all over the place.
>
>I found the the Left&Right Mouse click created a LASTKEY()=27.
>
>OK. So I trapped the problem. But how to I change the Lastkey() value ?
>
>
>Sample
>
>Object : oTrreview Procedure: MouseUp
>*** ActiveX Control Event ***
>LPARAMETERS button, shift, x, y
>
>IF LASTKEY()==27
>
> ???
>
>ENDIF
>
>IF button==2
> DO CASE
> CASE ALLTRIM(datalog.type)=='EQUIP'
> DO core_eq.mpr
> RELEASE MENU core_eq
> CASE ALLTRIM(datalog.type)=='FOLDER'
> DO core_ut.mpr
> RELEASE MENU core_ut
> ENDCASE
>
> RETURN
>
>ENDIF
>
>I have to release & clear but to no avail.
>
>Am I missing something very basic in my old age ?
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]