Clipboard question (OpenInsight Specific)
At 20 MAR 2000 09:27:32AM Oystein Reigem wrote:
From an OI app one can get and set the content of the Windows clipboard. With that one can implement one's own cut/copy/paste functionality. But this only works as long as the data is plain text. Now what I want to have in my app is a control with a different type of data, and I want my users to be able to cut, copy and paste content from/to that control. Can I do that?
(If you're really curious, my new control is an hierarchical list box, and I want my user to be able to cut/copy/paste nodes and sub-trees. But I don't think the exact nature of my control and its data is important to my question.)
I assume I have two options:
(I) Represent the cut/copied data as text, and use OI's standard clipboard capabilities.
(II) Use Windows API clipboard functions.
With (I) there is the danger the user will paste normal text (from their app or from other Window apps) into the new control. I don't want that to happen. Only data cut/copied from the control itself must be allowed. So I need some way to distinguish between any old text data, and genuinely relevant data originating from the control. In principle it's not possible to find a general solution, but in practice it is, e.g with prefixing the cut/copied text with some code or string unlikely to occur elsewhere.
There is also the danger the user will paste data the other way - from the new control to a normal text control. I don't see how I can avoid that. But perhaps the coding necessary for the new content type shouldn't be too exotic.
I haven't checked out (II) at all. I'd be interested to know if anybody else had. The crucial question is if one with (II) can define one's own clipboard data types, so one can automatically avoid the possible confusion described above. Unless that is the case I can as well use (I).
Now click that Response link and share your knowledge and good ideas with me.
![]()
- Oystein -
Øystein Reigem,
Humanities Information Technologies,
Allégt 27,
N-5007 Bergen,
Norway.
Tel: +47 55 58 32 42.
Fax: +47 55 58 94 70.
Home tel/fax: +47 56 14 06 11.