Form - mouse selected

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?
 
K

Kevin Spencer

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.
 
G

Guest

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
 
D

Dave Sexton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top