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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set sysmenu to ?? 1

Status
Not open for further replies.

foxup

Programmer
Dec 14, 2010
328
CA
Hi,

I seem to have run into a little snag. In my app, I run the "SET SYSMENU TO (blank)" to get of rid of the sysmenu because I obviously don't want my user to see it but they then lose the "COPY/PASTE (CTRL-C, CTRL-V)" capabilities. I would really need to fix that I can't seem to do it.

Please help.

Thanks,
FOXUP!
 
Hi,

Make your own menu, users will benifit from that.

Regards,

Jockey(2)
 
I don't want any menus to appear at all. I just want the functionality of the copy/paste back. Please help.


Thanks,
FOXUP!
 
Cut/Copy/Paste "belongs" to the system menu.

But here's the trick. You don't have to have the menu *showing*, it just has to be *defined*.

Generate a "quick menu" in the menu designer, copy the DEFINE PAD lines of code for the cut/copy/paste menu items, and then add them somewhere at the top of your application.

You can also teach users the original shortcuts. SHIFT-DEL for cut, CTRL-INS for copy, SHIFT-INS for paste. They're so deep in Windows' bone marrow they work almost everywhere unless those keystrokes have actively been blocked.
 
Or, put another way, execute the DEFINE BAR commands, but not the ACTIVATE POPUP.

Here is the full set of commands, including Undo, Redo and Select All, as well as Cut, Copy, Paste:

Code:
DEFINE BAR _med_undo OF shortcut PROMPT "\<Undo" ;
	KEY CTRL+Z, "Ctrl+Z" 
DEFINE BAR _med_redo OF shortcut PROMPT "Re\<do" ;
	KEY CTRL+R, "Ctrl+R" 
DEFINE BAR _med_cut OF shortcut PROMPT "Cu\<t" ;
	KEY CTRL+X, "Ctrl+X"
DEFINE BAR _med_copy OF shortcut PROMPT "\<Copy" ;
	KEY CTRL+C, "Ctrl+C" 
DEFINE BAR _med_paste OF shortcut PROMPT "\<Paste" ;
	KEY CTRL+V, "Ctrl+V" 
DEFINE BAR _med_slcta OF shortcut PROMPT "Se\<lect All" ;
	KEY CTRL+A, "Ctrl+A"

Put those at the start of your main program, and you should be OK.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
You can also teach users the original shortcuts. SHIFT-DEL for cut, CTRL-INS for copy, SHIFT-INS for paste. They're so deep in Windows' bone marrow they work almost everywhere unless those keystrokes have actively been blocked.

Dan, I'm always dubious about anything that involves having to educate users - especially when it comes to doing something that they will perceive as being unusual.

But thanks for reminding us about those original keys. It's not something I'd want to force users to use, but I might find a use for them myself sometime.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Yeah, I mention it only because most people don't know they're there.

They came before MSFT stole ... err, copied ... the Mac keystrokes. ;-) They've bailed me out a few times during code/test/crash cycles.
 
I can an error saying "MENU HAS NOT BEEN DEFINED WITH DEFINE POPOP"

Please any help?

Thank You
FOXUP!
 
It's OK, I fixed it. Thank You all. Star for you Mike as that's the code that helped me the most. Thanks everybody for all your help though. :)


THANKS!,
FOXUP!
 
How do users accept this functonality? Many users are "keyboard" users and use the short cut keys. But in my observations, far more are "mouse" users and use Copy/Cut/Paste from the menu. That type of user surely will not be happy with not having this capability on the menu.

Craig Berntson
MCSD, Visual C# MVP,
 
Gendev,

put "DEFINE POPUP shortcut" before Mike's code:

DEFINE POPUP test1
DEFINE BAR _med_undo OF test1 PROMPT "\<Undo" ;
KEY CTRL+Z, "Ctrl+Z"
DEFINE BAR _med_redo OF test1 PROMPT "Re\<do" ;
KEY CTRL+R, "Ctrl+R"
DEFINE BAR _med_cut OF test1 PROMPT "Cu\<t" ;
KEY CTRL+X, "Ctrl+X"
DEFINE BAR _med_copy OF test1 PROMPT "\<Copy" ;
KEY CTRL+C, "Ctrl+C"
DEFINE BAR _med_paste OF test1 PROMPT "\<Paste" ;
KEY CTRL+V, "Ctrl+V"
DEFINE BAR _med_slcta OF test1 PROMPT "Se\<lect All" ;
KEY CTRL+A, "Ctrl+A"

Done. :)

Oh, BTW, I have come into a little bug in VFP though. I'm sure somebody can help me. It doesn't "paste" the value properly in an 'INPUTBOX'.

Mike, (or anybody) any ideas? Please help.

Thanks,
FOXUP!
 
Foxup,

You're right. I left out the DEFINE POPUP. Well spotted.

Regarding the InputBox. It works OK for me. I can paste into it as normal. (But I've only tried in the development environment. I never use an InputBox is an application, so can't be sure if it will work there. Maybe somebody else can test it.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Anytime Mike! You help me so often, it's my turn to return the favour! :)

doesn't work in INPUTBOX in app mode. anything to be done please? :)


Thanks,
FOXUP!

 
I'm surprised it works anywhere in inputbox(). Menu shortcuts are typically disabled in modal forms.

If you want to allow paste, you could pass _CLIPTEXT as the third parameter to Inputbox(). That would get the contents of the clipboard as the default value, letting the user change it.

Of course, that may beget other surprises. :-(
 
Mike,

Inputbox does not work for me with in development VFP9SP2-Win7, (right click context menu) h.e. Ctrl+V pastes o.k. , haven't test in a exe.

Jockey(2)
 
Ctrl+V paste does not work in .app (or .exe) mode. Anybody have a fix? Please let me know. :)

Thank,
FOXUP!

 
Foxup,

What Dan was suggesting was something like this:

Code:
? INPUTBOX("Enter a value", "Input", _CLIPTEXT)

If there is text in the clipboard when you execute this command, that text will appear in the input box as the default value. But, as Dan suggests, that might not be the best way to do things.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Hi Mike,

Nah, that's not really a good way. If there is a previous "copy - the last (ctrl-c)" from something the user did a while back it will appear in there which is really bad. LOL

any other quick fix? Can anybody help out with this bug? :)

thanks,
FOXUP!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top