Click to See Complete Forum and Search --> : how can I let the user copy from but not paste anything to the SDI child area


Danielle Harvey
May 13th, 1999, 05:57 PM
How can I let the user copy information from the SDI child area but
not paste anything to the SDI child area? Currently, the user can not
copy nor paste anything from or to the SDI child area. It's somehow
locked!

Any response any one can give me will be greatly appreciated.

Wes Rogers
May 17th, 1999, 03:21 PM
Dear Danielle,

To let the user copy from your view window, you need to keep track of what is in the window, and the screen coordinates of everything that a user might be able to select. This will depend on whether you have text or graphics. This is usually done by keeping track of the "bounding rectangle" of the objects you are displaying.

Next, you need to be able to trap the coordinates of the window area the user has selected (usually via mouse down and mouse up events).

(Or, for text, get the area of the window selected and figure out which characters from your file fall into that area -- not always easy to do!)

Once you have this information, you can copy whatever was selected to the clipboard. This is usually in CF_TEXT or CF_BITMAP format.

To prevent pasting, you don't have to do anything. Pasting won't work unless you implement code to intercept a paste action and handle it.

You could also maybe try making your view window into a big edit box area or RTF control of some sort.

I hope this gives you a strategy,
Wes Rogers