Skip to main content
We have used the tinymce editor (based on the samples in the downloads), to allow for editing HTML to send as emails. 
I want to create a popup menu including copy/paste from here.
Our current popup menu uses macro "^INS_SELECT" which doesn't work. 
Ctrl-C/Ctrl-V do work, is there a method of using these from a uniface popup menu? 
Regards, 
Iain

------------------------------
Iain Sharp
Head of Technical Services
Pci Systems Ltd
Sheffield GB
------------------------------
We have used the tinymce editor (based on the samples in the downloads), to allow for editing HTML to send as emails. 
I want to create a popup menu including copy/paste from here.
Our current popup menu uses macro "^INS_SELECT" which doesn't work. 
Ctrl-C/Ctrl-V do work, is there a method of using these from a uniface popup menu? 
Regards, 
Iain

------------------------------
Iain Sharp
Head of Technical Services
Pci Systems Ltd
Sheffield GB
------------------------------
I guess you could call a JavaScript function from the popup menu (using $widgetoperation). Did a quick web search and found (e.g.) this:
I hope this helps.

Regards,
Daniel

------------------------------
Daniel Iseli
Principal Technical Support Engineer
Uniface Services
Rocket Software, Switzerland
------------------------------
I guess you could call a JavaScript function from the popup menu (using $widgetoperation). Did a quick web search and found (e.g.) this:
I hope this helps.

Regards,
Daniel

------------------------------
Daniel Iseli
Principal Technical Support Engineer
Uniface Services
Rocket Software, Switzerland
------------------------------
Pasting into the HTML widget is more what is required here. The copy function would be useful, but I’ve got customers (who don’t use keyboard commands as a rule) complaining they can’t paste.
I can’t just replace the contents of the editor, because they will expect the paste to work like Ctrl-V.


Regards,

Iain

Pasting into the HTML widget is more what is required here. The copy function would be useful, but I’ve got customers (who don’t use keyboard commands as a rule) complaining they can’t paste.
I can’t just replace the contents of the editor, because they will expect the paste to work like Ctrl-V.


Regards,

Iain

In that case you should be able to use the Paste plugin of the editor. It has a JavaScript command that seems to allow pasting from the clipboard at (e.g.) the cursor location. You just have to encapsulate the required commands in a JavaScript function that you then call with $widgetoperation.

I hope this helps.

Regards,
Daniel



------------------------------
Daniel Iseli
Principal Technical Support Engineer
Uniface Services
Rocket Software, Switzerland
------------------------------

In that case you should be able to use the Paste plugin of the editor. It has a JavaScript command that seems to allow pasting from the clipboard at (e.g.) the cursor location. You just have to encapsulate the required commands in a JavaScript function that you then call with $widgetoperation.

I hope this helps.

Regards,
Daniel



------------------------------
Daniel Iseli
Principal Technical Support Engineer
Uniface Services
Rocket Software, Switzerland
------------------------------
The plugin gives an error because “The toolbar button won’t work in browsers that don’t support direct access to the clipboard”, which I presume covers cefrender. (We’ve already got the menu option within the tinymce toolbar, and it fails due to this error. )

Regards,
Iain

The plugin gives an error because “The toolbar button won’t work in browsers that don’t support direct access to the clipboard”, which I presume covers cefrender. (We’ve already got the menu option within the tinymce toolbar, and it fails due to this error. )

Regards,
Iain
Okay, in that case I have another way: in the sample there is a JS function called setTextToEditor (see the blockdata in the entry setHTML_Editor2 that is defined in the code container of the sample form) and if you replace "tinyMCE.activeEditor.selection.setContent" with "tinyMCE.activeEditor.selection.insertContent" then it will past the text you pass to the function (when pressing the button BTN_SETTEXT) at the cursor position.

I hope this helps.

Regards,
Daniel

------------------------------
Daniel Iseli
Principal Technical Support Engineer
Uniface Services
Rocket Software, Switzerland
------------------------------
We have used the tinymce editor (based on the samples in the downloads), to allow for editing HTML to send as emails. 
I want to create a popup menu including copy/paste from here.
Our current popup menu uses macro "^INS_SELECT" which doesn't work. 
Ctrl-C/Ctrl-V do work, is there a method of using these from a uniface popup menu? 
Regards, 
Iain

------------------------------
Iain Sharp
Head of Technical Services
Pci Systems Ltd
Sheffield GB
------------------------------
Hi All,

An other solution is to simulate the CTRL+C /CTRL+V keypress.
Declare a signature on user32.dll  with an operation on the function keybd_event.
something like :
;define code
#define KEYEVENTF_KEYUP = 2 ; 0x02
#define VK_SHIFT = 16 ; 0x10
#define VK_CONTROL = 17 ; 0x11
#define I_key = 73 ; 0x49
#define C_key = 67 
#define V_key = 86 
;ctrl+c
newinstance "USER32",user32
activate user32->keybd_event(<VK_CONTROL>, 0, 0, 0)
activate user32->keybd_event(<C_key>, 0, 0, 0)
activate user32->keybd_event(<C_key>, 0, <KEYEVENTF_KEYUP>, 0)
activate user32->keybd_event(<VK_CONTROL>, 0, <KEYEVENTF_KEYUP>, 0)
;ctrl+v
activate user32->keybd_event(<VK_CONTROL>, 0, 0, 0)
activate user32->keybd_event(<V_key>, 0, 0, 0)
activate user32->keybd_event(<V_key>, 0, <KEYEVENTF_KEYUP>, 0)
activate user32->keybd_event(<VK_CONTROL>, 0, <KEYEVENTF_KEYUP>, 0)​



------------------------------
Hortion Gilles
Dedalus Healthcare France
Artigues Pres Bordeaux FR
------------------------------


Hi All,

An other solution is to simulate the CTRL+C /CTRL+V keypress.
Declare a signature on user32.dll  with an operation on the function keybd_event.
something like :
;define code
#define KEYEVENTF_KEYUP = 2 ; 0x02
#define VK_SHIFT = 16 ; 0x10
#define VK_CONTROL = 17 ; 0x11
#define I_key = 73 ; 0x49
#define C_key = 67 
#define V_key = 86 
;ctrl+c
newinstance "USER32",user32
activate user32->keybd_event(<VK_CONTROL>, 0, 0, 0)
activate user32->keybd_event(<C_key>, 0, 0, 0)
activate user32->keybd_event(<C_key>, 0, <KEYEVENTF_KEYUP>, 0)
activate user32->keybd_event(<VK_CONTROL>, 0, <KEYEVENTF_KEYUP>, 0)
;ctrl+v
activate user32->keybd_event(<VK_CONTROL>, 0, 0, 0)
activate user32->keybd_event(<V_key>, 0, 0, 0)
activate user32->keybd_event(<V_key>, 0, <KEYEVENTF_KEYUP>, 0)
activate user32->keybd_event(<VK_CONTROL>, 0, <KEYEVENTF_KEYUP>, 0)​



------------------------------
Hortion Gilles
Dedalus Healthcare France
Artigues Pres Bordeaux FR
------------------------------

So, I've got to the point where I can try this, and it's giving me a -58 on the calls to user32. 
I've tried it with user32 as a handle, or public handle, and using user32->keybd_event and also with user32 as a string and using activate.user32.keybd_event.
I can only think I've defined the signature wrong. I've included it here, any advice?

------------------------------
Iain Sharp
Head of Technical Services
Pci Systems Ltd
Sheffield GB
------------------------------
So, I've got to the point where I can try this, and it's giving me a -58 on the calls to user32. 
I've tried it with user32 as a handle, or public handle, and using user32->keybd_event and also with user32 as a string and using activate.user32.keybd_event.
I can only think I've defined the signature wrong. I've included it here, any advice?

------------------------------
Iain Sharp
Head of Technical Services
Pci Systems Ltd
Sheffield GB
------------------------------
Hi Iain,
I make an export of our signature.
Cordialy,

------------------------------
Hortion Gilles
Dedalus Healthcare France
Artigues Pres Bordeaux FR
------------------------------
Hi Iain,
I make an export of our signature.
Cordialy,

------------------------------
Hortion Gilles
Dedalus Healthcare France
Artigues Pres Bordeaux FR
------------------------------
Hmm, I deleted mine and imported yours, there's obviously something wrong with signature deletion in V10, because I got all my old parameters as well as yours so I deleted them all one by one, then the operation, then the signature and re-imported. 
Anyway, I can't see any major differences between the two, but your signature is not giving the error, so there must have been something somewhere. 

Long story short, that's working well, thank you. 

Iain

------------------------------
Iain Sharp
Head of Technical Services
Pci Systems Ltd
Sheffield GB
------------------------------