Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Clipboard Functions
Message
From
14/06/2001 09:04:36
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
13/06/2001 23:41:26
Grover Cox
Regional Transit Partners
Atlanta, Georgia, United States
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00519175
Message ID:
00519255
Views:
13
>I need some help setting up buttons in my form to Cut, Copy & Paste selected text in a field to and from the Windows clipboard. I have achieved some limited success using shortcut keys instead of buttons. But I need the same functionality via a button in my form. The problem is when text is selected in a field and then you select a button the selected text in the field loses focus when the button is clicked and there is then nothing to cut or copy to the clipboard. The only info. I have found on this topic is in Technet that discusses how to use the standard VFP Edit menu bars to perform these functions. I have setup a shortcut menu with these functions that is started and then deactivated in the Init event of a sample form. This allows the shortcut keys (CTRL+X,C,V) to work. But trying to use buttons instead of the shortcut keys doesn't work, apparently for the reason listed above. I am at a deadend right now and could use some one elses point of view on this problem. I feel
>there is a solution, but am unsure where to go from here.
>
>Thanks for all feedback!

Grover,
You could use buttons on form but is easier with toolbar buttons. Difference is that toolbar buttons doesn't cause a lostfocus. If you'd use form buttons then you should save selected text in lostfocus. ie:
*Textbox.lostfocus
this.Tag = this.SelText
* Also save controls full hierarchy name
thisform.Tag = stuff(sys(1272,this), 1, at('.',sys(1272,this)), 'thisform.')

*Copy click
if !empty(thisform.Tag)
 with eval(thisform.Tag)
   _cliptext = .Tag
 endwith
endif

*Cut click
if !empty(thisform.Tag)
 with eval(thisform.Tag)
   .Value = strtran(.Value, .Tag, '')
 endwith
endif

*Paste click
if !empty(thisform.Tag)
 with eval(thisform.Tag)
   _cliptext = .Tag
   .Value = _cliptext
 endwith
endif
Of course code needs revision but gives the idea. With toolbars it would be much more easier. Also having the menu only defined (not need be visible) would provide Ctrl+C,X,V what user already knows how to use.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform