Copy and paste (control-c and control-v) in TGNumberEntry

Is there a good way I can implement typical copy/paste (control-c/control-v) behavior on TGNumberEntry and TGNumberEntryFields?



It is already implemented! Copy/paste works with Ctrl-C/Ctrl-V and with the mouse, at least on Linux(SLC4)/Gnome and Windows.

Cheers, Bertrand.

Hi Bertrand,

Hmmm. I’m using root 5.24 on windows, and I’ve tried this with the root/tutorials/gui/guitest.C tutorial. I bring up the Number Entry Test, and I don’t get the paste functionality. I can highlight a number field’s data with the mouse, and do a control-C to copy, and control-v paste into notepad, but I cannot paste into a number entry field.

I also do not get any pop-up context menu when I right-click, which is the only way I know how to use the mouse to copy/paste.


As I said, it works for me on Windows (with guitest.C too)
Now, you may have a problem when pasting a number which is not the right format (there is no automatic conversion…)
And to copy/paste with the mouse: copy by selecting (highlighting) with the left mouse button and paste with the middle mouse button.

Cheers, Bertrand.

Your last post was very enlightening for me, and explained why copy/paste doesn’t work they way I think it should. It’s because Root automatically copies when text is selected/highlighted with the left mouse button.

My experience (Windows and linux) and expectation for copy/paste is:

  1. Select field to copy with left mouse. (ie. the field is numeric 123)
  2. Type Control-C to copy field.
  3. Select field to paste into with left mouse. (ie. some other field already has data, say 456, and I want to paste over this field)
  4. Type Control-V to paste field over existing selected field.

But with Root, when I select the field to paste over, it’s contents are copied, so when I paste, I get the same data back.

So how do I select a field (that already has data) to paste over?
In other words, how can I select a field and delete it’s current data, so I can paste new data into it (without accidentally copying it when I select it).


Hi buddy,

Sorry, but you cannot, at least with the actual implementation. You have to delete the target’s content first.
And I don’t see a quick, easy, cross-platform, WM independent way of implementing it right now…

Cheers, Bertrand.