Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Callable but invisible menu pads ?
Message
From
16/03/2004 06:57:07
 
 
To
15/03/2004 18:37:56
General information
Forum:
Visual FoxPro
Category:
Menus & Menu designer
Miscellaneous
Thread ID:
00886543
Message ID:
00886627
Views:
24
Hi Alex.

Is it possible to define menu pads that can be called programmatically but are not visible?

Using Garrett's example, to allow the users to acces copy, paste, etc,. functionality using the hot keys without having to have them available in the menu, just define the menu like so but to do activate it:
LOCAL cMenuName, nTotPops, a_menupops, cTypeParm2, cSaveFormName

m.cTypeParm2 = TYPE("m.getMenuName")
m.cMenuName = SYS(2015)
m.cSaveFormName = This.Name
IF m.cTypeParm2 = "C" OR (m.cTypeParm2 = "L" AND m.getMenuName)
  m.oFormRef.Name = m.cMenuName
ENDIF
IF m.cTypeParm2 = "C" AND !EMPTY(m.getMenuName)
  m.cMenuName = m.getMenuName
ENDIF
DIMENSION a_menupops[1]
IF TYPE("m.lUniquePopups")="L" AND m.lUniquePopups
  FOR nTotPops = 1 TO ALEN(a_menupops)
    a_menupops[m.nTotPops]= SYS(2015)
  ENDFOR
ELSE
  a_menupops[1]="edit"
ENDIF


*       *********************************************************
*       *                                                         
*       *                      Menu Definition                    
*       *                                                         
*       *********************************************************
*

DEFINE MENU (m.cMenuName) IN (This.Name) BAR

DEFINE PAD Edit OF (m.cMenuName) PROMPT "\<Edit" COLOR SCHEME 3 ;
  KEY ALT+E, "ALT+E" ;
  SKIP FOR !FormIsObject()  ;
  MESSAGE "Edits text or current selection"
ON PAD Edit OF (m.cMenuName) ACTIVATE POPUP (a_menupops[1])

DEFINE POPUP (a_menupops[1]) MARGIN RELATIVE SHADOW COLOR SCHEME 4
DEFINE BAR _med_undo OF (a_menupops[1]) PROMPT "\<Undo" ;
  KEY CTRL+Z, "Ctrl+Z" 
DEFINE BAR _med_cut OF (a_menupops[1]) PROMPT "Cu\<t" ;
  KEY CTRL+X, "Ctrl+X" 
DEFINE BAR _med_copy OF (a_menupops[1]) PROMPT "\<Copy" ;
  KEY CTRL+C, "Ctrl+C" 
DEFINE BAR _med_paste OF (a_menupops[1]) PROMPT "\<Paste" ;
  KEY CTRL+V, "Ctrl+V" 
DEFINE BAR 6 OF (a_menupops[1]) PROMPT "\-"
DEFINE BAR _med_slcta OF (a_menupops[1]) PROMPT "Select \<All" ;
  KEY CTRL+A, "Ctrl+A" 

IF m.cTypeParm2 = "C"
  m.getMenuName = m.cMenuName
  m.oFormRef.Name = m.cSaveFormName 
ENDIF
Now, if you want to call the copy functionality programmatically (like from a command button or a shortcut menu), use this code:
SYS( 1500, '_MED_COPY', '_MEDIT' )
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform