Global copy & paste?

I have several Windows with several textfields and textareas in my app. How can i implement a “global” copy & paste, so that i can use command-c to copy text from every textfield or textarea within my app to the clipboard and paste it e.g. to another textfield in another window?

I read the documentation, but it seems that i have to implement a clipboard method for every gui-element that i want to copy from or paste to.

What would that look like? For example, say the original window had three TextFields on it. After you copy, what would get pasted elsewhere?

Or do you mean that you are trying to copy all the fields of Window1 into Window2 where both are an instance of the same Window class?

if it is within the same application, I would forego using the Clipboard, and just programmitcally move/copy data from one place to the other

Hi Kem.

Lets say i have Window1 and there is a textfield1 placed on it. Now i want to copy the text from this textfield an paste it into textfield2 which is placed an Windows2.

I just want to be able to copy text from every textfield or textarea that is placed on my Windows. Only one to one. Copy from one field to another,

What if there is TextField1 and TextField2 on Window1? What do you want to copy then, and do where will it go?

I’m trying to understand what you want to do that’s different than a normal copy and paste, so please bear with me.

Hi Dave,

copy and to between two windows was only an example. I also want to use a simple copy & paste from one textfield to another on the same window. Usecase: a user has two fields on a window: one has a customer name in it an another the name of a contact. Both is eventually the same, so my user just writes these name only once and copy this string to the other field.

i think i did not explain it very well. You name it, kem. I just want a normal copy & paste. But the menuitems are disabled in my app and i only get a Error-Sound when using Command-C e.g.

just created a new app, placed two textfields on the window and i am able to use normal copy & paste. Must be something broken in my app. have to look at the menuhandlers, i think.

Oh, that shouldn’t be. Copy and Paste is handled by Xojo by default unless you did something special to disable the menu items for them.

(You beat me to it. :slight_smile: )

In my MenuBar1, there are the default EditMenu MenuItems for Undo, Cut, Copy, Paste, Delete and Select All. The MainWindow e.g. has the MenuBar1 assigned to it. But the MenuItems are disabled.

What do i have to check else?

Got my error. I had renamed the MenuItems a long time ago from EditCopy to miEditCopy and so on. I Think the Xojo-Handling needs the original MenuItem names.

Now it works.