Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Shortcut menu on EditBox
Message
From
19/01/2009 08:13:57
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00610274
Message ID:
01375018
Views:
46
This message has been marked as a message which has helped to the initial question of the thread.
>>>Hi everyone,
>>>
>>>I'd like to create a shortcut menu (on Right Click) for the editbox, which has to include all standard Edit menu commands (or some essential): Copy, Cut, Paste, Print. They should behave correctly, e.g. is something is in clipboard, then paste is active and vs. Could you please point me to the right direction?
>>>
>>>Thanks a lot in advance.
>>
>>
*Rightclick
>>activate popup ccp at mrow(),mcol()
>>
>>*form.load
>>DEFINE POPUP ccp SHORTCUT RELATIVE
>>DEFINE BAR _med_cut OF ccp PROMPT "Cu\<t" ;
>> KEY CTRL+X, "Ctrl+X" ;
>> MESSAGE "Removes the selection and places it onto the Clipboard"
>>DEFINE BAR _med_copy OF ccp PROMPT "\<Copy" ;
>> KEY CTRL+C, "Ctrl+C" ;
>> MESSAGE "Copies the selection onto the Clipboard"
>>DEFINE BAR _med_paste OF ccp PROMPT "\<Paste" ;
>> KEY CTRL+V, "Ctrl+V" ;
>> MESSAGE "Pastes the contents of the Clipboard"
>>DEFINE BAR _med_slcta OF ccp PROMPT "Se\<lect All" ;
>> KEY CTRL+A, "Ctrl+A" ;
>> MESSAGE "Selects all text or items in the current window"
>>
Cetin
>
>Hi Cetin,
>
>Thanks again. I now want slightly different menu with 3 items: Find, Continue (if Find was active) and Print. Find will prompt for the text to find and then highlight this text (first occurrence in the EditBox), continue will continue to search for that text...
>
>Do you have ideas how to implement such menu on an EditBox?
>
>Thanks in advance.



We know
(1) CTRL+F does a find - not difficult to implement
(2) On the find menu, there's a next


You may want to change the key values
&& (1) RightClick - see two last bars

DEFINE POPUP ccp SHORTCUT RELATIVE from mrow(),mcol()


DEFINE BAR _med_cut OF ccp PROMPT "Cu\<t" ;
	KEY CTRL+X, "Ctrl+X" ;
	MESSAGE "Removes the selection and places it onto the Clipboard"
	
DEFINE BAR _med_copy OF ccp PROMPT "\<Copy" ;
	KEY CTRL+C, "Ctrl+C" ;
	MESSAGE "Copies the selection onto the Clipboard"
	
DEFINE BAR _med_paste OF ccp PROMPT "\<Paste" ;
	KEY CTRL+V, "Ctrl+V" ;
	MESSAGE "Pastes the contents of the Clipboard"
	
DEFINE BAR _med_slcta OF ccp PROMPT "Se\<lect All" ;
	KEY CTRL+A, "Ctrl+A" ;
	MESSAGE "Selects all text or items in the current window"

define bar _MED_FIND of ccp prompt '\<Find' ;
	key CTRL+F, 'Ctrl+F' ;
	message 'Finds text in the current window'

define bar (cntbar('ccp')) + 1 of ccp prompt 'Find Nex\<t' ;
	key CTRL+T, 'Ctrl+T' ;
	message 'Find Next'

on selection bar (cntbar('ccp')) of ccp ;
	Keyboard "{CTRL+F}{ALT+N}" plain clear
	
activate popup ccp

release popup ccp
&& (2) KeyPress
LPARAMETERS nKeyCode, nShiftAltCtrl

if( inlist(m.nShiftAltCtrl, 2) and  inlist(m.nKeyCode, 20) )
	NODEFAULT
	keyboard "{CTRL+F}{ALT+N}" plain clear
endif
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform