Attached is a library that contains a MsgBox Designer (feel free to use it). The start procedure is MsgBoxDialog.
What I want is to add a “Copy code to Clipboard” button. When I click on the button, the text from the txtCode multiline control should be copied to the Clipboard.
I’ve tried everything I know and everything Gemini + ChatGPT told me, but nothing works.
MsgBoxDesigner.zip (3.9 KB)
Where is your problem: get text or copy to clipboard
May I suggest google …
are my first two hits…
Please attach a document of an odf
type containg your code. A replacement for the Sub you don’t yet get to work may simply tell “Here I am!”
This way a contributor can much more easily (or at all) see what you actually try to achieve than by studying files from your profile.
Thanks to everyone who responded. I attached a Calc file in which I simplified: there is a dialog with two controls, a button and a TextBox. I want the button’s Execute Action event to copy the text from the TextBox to the Clipboard.
Initially I did not attach a document, because what I did does not use or work with files. No file of any kind. It is a visual Designer for MsgBox and is only used within the Basic IDE.
The problem seemed simple to me, but, as someone said here, the API only offers the possibility of copying from files, I think.
I will try to write the text to a temporary txt file, then copy its content to the Clipboard, and then delete the file.
Copy2Clipboard.ods (10.3 KB)
The control of clipboard is added to dialog in ODS you uploaded
Copy2Clipboard-editKL1.ods (12.0 kB)
Thanks. This is.
The interface Xtransferable
only has a scope of the CurrentController
and controllers
obtained via the StarDesktop
, imo.
To push something to the system’s clipboard you need (afaik) to use the dispatcher with the UNO command .uno:Copy
.
This requires that the content you want to push is the CurrentSelection
of a document (controller
) which is handled by your code.
This can be a document which also contains the code or a document which is created by ThisComponent
for the purpose.
I was wrong.