Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FFC ShortCut Menu Class - How to use
Message
From
23/12/2011 23:39:41
Jim Wiggins
Affordable Custom Software
Illinois, United States
 
 
To
23/12/2011 13:22:44
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01531620
Message ID:
01531647
Views:
122
Here's an alternative to using the FFC. Put this in the RightClick of the controls (the class they are based on). It assumes they are controls such as text box or edit box so that the user can select some text.
* NOTE: You should probably set _CLIPTEXT="" in the control's GotFocus
LOCAL lcField, lcChoice
DEFINE POPUP ShortcutMenu ;
		FROM MROW(),MCOL() ;
		MARGIN ;
		RELATIVE ;
		SHORTCUT
DEFINE BAR 1 OF ShortcutMenu PROMPT "\<Copy" SKIP FOR this.SelLength=0		
DEFINE BAR 2 OF ShortcutMenu PROMPT "Cu\<t" SKIP FOR this.SelLength=0		
DEFINE BAR 3 OF ShortcutMenu PROMPT "\<Paste" SKIP FOR EMPTY(_CLIPTEXT)
DEFINE BAR 4 OF ShortcutMenu PROMPT "Paste T\<o" SKIP FOR EMPTY(_CLIPTEXT)

DEFINE POPUP FieldList SHORTCUT 
DEFINE BAR 1 OF FieldList PROMPT "First Name" SKIP FOR EMPTY(_CLIPTEXT)
DEFINE BAR 2 OF FieldList PROMPT "Last Name" SKIP FOR EMPTY(_CLIPTEXT)

ON BAR 4 OF ShortcutMenu ACTIVATE POPUP FieldList
ON SELECTION POPUP ShortcutMenu lcChoice = PROMPT()
ON SELECTION POPUP FieldList lcField = PROMPT()
ACTIVATE POPUP ShortcutMenu

IF VARTYPE(lcField)="C"
  DO CASE 
  CASE lcField = "First Name"
    * replace fname with _CLIPTEXT
    MESSAGEBOX("First Name")
  CASE lcField = "Last Name"
    * replace lname with _CLIPTEXT
    MESSAGEBOX("Last Name")
  ENDCASE
ENDIF 

DO CASE 
CASE VARTYPE(lcChoice)<>"C"
  RETURN
CASE lcChoice = "Copy"
  SYS(1500,"_med_copy","_medit")
CASE lcChoice = "Cut"
  SYS(1500,"_med_cut","_medit")
CASE lcChoice == "Paste"  && notice the ==
  SYS(1500,"_med_paste","_medit")
ENDCASE
Previous
Reply
Map
View

Click here to load this message in the networking platform