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!

ShortCut (menu) Timeout

Status
Not open for further replies.

wsjames

Programmer
Apr 7, 2003
50
US
Is it possible [in VFP9] to progamatically timeout a shortcut menu? I would like to timeout [close] the shortcut if activated, but not used/closed within xSeconds.
 
Why?
Create a class based on timer.
Add properties named cShortCutName, nTimeOut (with Assign method)
Then before ACTIVATE SHORTCUT put:
Code:
oForm = CREATEOBJECT([Form1])
oForm.Show(1)


DEFINE CLASS Form1 AS Form 
      KeyPreview = .t.

      ADD OBJECT Text1 AS TextBox WITH;
      Left =0,;
      Top=0,;
      Width = 200,;
      Value = "RightClick Me"
      
      
      PROCEDURE Text1.RightClick
            LOCAL loTimer AS Timer1
            DEFINE POPUP shortcut SHORTCUT RELATIVE FROM MROW(),MCOL() MARGIN
            DEFINE BAR 1  OF shortcut PROMPT "Test" ;
                KEY CTRL+X, "Ctrl+X"

            DEFINE BAR 2  OF shortcut PROMPT "Test 2"
            loTimer = NEWOBJECT([Timer1])
            loTimer.cShortCutName = [shortcut]
            loTimer.nTimeOut      = 1
            ACTIVATE POPUP shortcut
            WAIT WINDOW [After Popuup]
      ENDPROC
      
      PROCEDURE KeyPres(nKey, nShift)
      IF nKey == 27
          thisform.Release()
      ENDIF
ENDDEFINE



DEFINE CLASS Timer1 AS Timer 
   cShortCutName = []
   nTimeOut      = 0
   Interval      = 0
   
   PROCEDURE nTimeOut_Assign(lnNewValue)
        this.Interval = lnNewValue * 1000
   RETURN
   
   PROCEDURE Timer
       IF NOT EMPTY(this.cShortCutName)
         DEACTIVATE POPUP (this.cShortCutName)
       ENDIF
   RETURN
ENDDEFINE

NOT WELL Tested!

Borislav Borissov
VFP9 SP2, SQL Server 2000/2005.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top