Form - mouse selected

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to enable my disabled menu options (cut, copy & paste). The
requirement is to determine what on my form has been selected with the mouse.

How can I determine this?
 
It all depends on what you mean by "selected with the mouse." That is not a
technical term that translates to anything meaningful. Do you mean when a
Control has the focus? If not, what *do* you mean?

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

What You Seek Is What You Get.
 
I have a windows form with a AxSHDocVw embedded. So I want to determine the
following:

A) When a user left-clicks on the mouse and select some text
B) Determine the x and y coordinates of what was selected

when A is fulfilled I want to enable my menu option.
and when the menu copy is clicked I want to copy all text within B.

thanks
 
Hi,

That fact that you're using an ActiveX web browser is really important and should have been mentioned in the OP. You'll have to use
DOM events.

Accessing DHTML DOM through AxSHDocVw (MSDN:)
http://msdn.microsoft.com/library/d...ml/vsgrfwalkthroughaccessingdhtmldomfromc.asp

document.onselectionchange event (MSDN):
http://msdn.microsoft.com/library/d.../dhtml/reference/events/onselectionchange.asp

To copy the selected text you don't need x and y coordinates. See the following links:

execCommand method (MSDN):
http://msdn.microsoft.com/library/d.../reference/methods/execcommand.asp?frame=true

Copy command (MSDN):
http://msdn.microsoft.com/library/d...hop/author/dhtml/reference/constants/copy.asp

queryCommandEnabled method (MSDN):
http://msdn.microsoft.com/library/d...ce/methods/querycommandenabled.asp?frame=true

HTH
 
Back
Top