Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Lastkey() Loop within oTreeview: MouseUp
Message
From
01/08/2003 04:22:34
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00815757
Message ID:
00815767
Views:
12
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:
*** ActiveX-Steuerelementereignis MouseDown***
LPARAMETERS;
 tnButton,;
 tnSHIFT,;
 tnX,;
 tnY
 
WITH THIS
 .goCurrentNode    = .AktNode(tnX,tnY)

 IF !ISNULL(.goCurrentNode) THEN
*Clicked on a node
  DO CASE
*left
   CASE tnButton=1
    .goCurrentNode.SELECTED = True
    .goDragedNode = .goCurrentNode
*right
   CASE tnButton=2
    .NodeRightClick(.goCurrentNode)
*middle
   CASE tnButton=4
    .NodeMiddleClick(.goCurrentNode)
  ENDCASE
 ELSE
*Clicked on white space
  .goCurrentNode    = .SELECTEDITEM
  DO CASE
*left
*  CASE tnButton=1
* unused
*right
   CASE tnButton=2
    .TreeRightClick()
*middle
   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
*Rechtsshift
  CASE tnKeyCode=27 AND tnShift=0
*ESC
   NODEFAULT
  CASE tnKeyCode=121
*   SHIFT+F10
*   Right click 
   IF !ISNULL(.SELECTEDITEM) THEN
    .NodeRightClick(.SELECTEDITEM)
   ELSE &&!ISNULL(.SELECTEDITEM)
    .TreeRightClick()
   ENDIF &&!ISNULL(.SELECTEDITEM)
 ...
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.

Off

There is no place like [::1]
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform