Paste into Fl_Input with mouse

76 views
Skip to first unread message

bat

unread,
Sep 3, 2013, 9:30:24 AM9/3/13
to fltkg...@googlegroups.com
Hello, I was wondering if it is possible to paste text into a Fl_Input box with the mouse somehow. I can do it with control V but the right mouse-click doesn't seem to do anything and I was wondering if there is a way to get a bit of code from somewhere or set an option to make it more like the 'windows' right-button paste effect. Many thanks.

bat

unread,
Sep 3, 2013, 9:35:41 AM9/3/13
to fltkg...@googlegroups.com
Sorry, I now see there's something in Erco's cheat sheet. I'll try that first. 

bat

unread,
Sep 3, 2013, 10:26:22 AM9/3/13
to fltkg...@googlegroups.com
Sorry again. Let me re-phrase the question... the example in the cheat sheet works beautifully and it seems to allow text to be copied from the input box and pasted back into it. However I would like to be able to use the mouse to paste text in from another source, which I can't yet manage with the cheat sheet example. Any clues much appreciated. 

Greg Ercolano

unread,
Sep 3, 2013, 3:36:50 PM9/3/13
to fltkg...@googlegroups.com
On 09/03/13 07:26, bat wrote:
> Sorry again. Let me re-phrase the question... the example in the cheat sheet
> works beautifully and it seems to allow text to be copied from the input box
> and pasted back into it. However I would like to be able to use the mouse
> to paste text in from another source, which I can't yet manage with the
> cheat sheet example. Any clues much appreciated.

Sounds like it depends on the source.. what is the source application,
and what version of the window manager/distro/OS?

It should be able to paste from things like the terminal and text
editors, web browsers, etc. But only if the source supports ASCII
or utf-8 encoded text. Anything else Fl_Input will reject.

IIRC, apps like Firefox try sending several payloads; first as 'formatted'
(html?), and then provides ascii as a fallback, which is what FLTK would use.

Fl_Input supports input pastes of ascii + utf8 text with ^V, drag+drop,
and yes, with the cheat sheet example, a right-click "Copy/Paste" popup menu.




bat

unread,
Sep 3, 2013, 4:51:39 PM9/3/13
to fltkg...@googlegroups.com, erco_...@seriss.com
Hello, it is Windows XP (SP3) and I am compiling with MinGW. I have tried the same executable on a Windows 7 machine and I get the same effect, i.e. that I can only paste 'external' text with CTRL V and not with the right mouse button. I have tried copying plain text from notepad but the right mouse button only seems to allow copy and paste within the widget, not from outside the widget.

Greg Ercolano

unread,
Sep 3, 2013, 5:30:35 PM9/3/13
to fltkg...@googlegroups.com
Hmm, what version of FLTK is this?
It sounds like an old problem.. I recall sometime way back
there was a problem pasting text from other apps into FLTK widgets.

Be sure you're on 1.3.2 or 1.3.x svn current.

bat

unread,
Sep 3, 2013, 5:39:16 PM9/3/13
to fltkg...@googlegroups.com, erco_...@seriss.com
Hello it is fltk-1.3.2

Cheers for looking at this. 

Greg Ercolano

unread,
Sep 3, 2013, 5:53:48 PM9/3/13
to fltkg...@googlegroups.com
On 09/03/13 14:39, bat wrote:
> Hello it is fltk-1.3.2

I'll try to replicate and report back.

You say it works with Ctrl-V but not with right mouse,
which might mean the code on the cheat page needs improvement.

I'll compare that cheat page code to what we have in Fl_Input/Fl_Input_;
there's probably some extra logic needed in the cheat example.

Greg Ercolano

unread,
Sep 3, 2013, 5:55:42 PM9/3/13
to fltkg...@googlegroups.com
On 09/03/13 14:53, Greg Ercolano wrote:
> On 09/03/13 14:39, bat wrote:
>> Hello it is fltk-1.3.2
>
> I'll try to replicate and report back.
>
> You say it works with Ctrl-V but not with right mouse,
> which might mean the code on the cheat page needs improvement.

OK, think I found it.
Try changing this line in the cheat example:

BEFORE: Fl::paste(*in);
AFTER: Fl::paste(*in, 1);

I could replicate with notepad, and that seems to fix the problem.

If that works for you too, I'll update the cheat page example.

keghn feem

unread,
Sep 3, 2013, 6:05:28 PM9/3/13
to fltkg...@googlegroups.com


 Hello,
 Is this discussion about the Fluid's sup input window like "new/code/code..",or "new/code/function/method"?
 If it is, on my Linux system i miss the right click and copy high lighted text. But I
can use the middle button on my mouse to copy high lighted text to a new location in
the GUI. Do the same thing when copying text/code from my notes.txt into FLUID.

Greg Ercolano

unread,
Sep 3, 2013, 6:25:39 PM9/3/13
to fltkg...@googlegroups.com
I don't think fluid is involved in the OP's question.
I think it's more about adding a copy/paste menu to Fl_Box and/or Fl_Input.

If you're asking for a feature, best to start another thread
or open an STR request for the enhancement to fluid.

bat

unread,
Sep 3, 2013, 6:36:25 PM9/3/13
to fltkg...@googlegroups.com, erco_...@seriss.com
Hello again,

that fixed it for me, many thanks!!

MacArthur, Ian (Selex ES, UK)

unread,
Sep 4, 2013, 4:07:34 AM9/4/13
to fltkg...@googlegroups.com

> Is this discussion about the Fluid's sup input
> window like "new/code/code..",or "new/code/function/method"?

No, I think it is just about the Fl_Input widget in a general case.

> If it is, on my Linux system i miss the right click and copy
> high lighted text. But I can use the middle button on my mouse
> to copy high lighted text to a new location in the GUI. Do the
> same thing when copying text/code from my notes.txt into FLUID.

The OP (bat) is asking about a Windows use rather than Linux, I believe.

The pasting behaviour you describe (with the middle mouse button) is a common feature on many X11 platforms, indeed I think gpm even supports it in a text console, but it is not commonplace on non-*nix hosts.

Indeed, the whole X11 copy/paste mechanism is quite complex, there are in effect two systems, running in parallel, one with a basic clipboard and a more complex system of paste buffers, and that complicates any cut/copy/paste code under X11. The fltk implementation is pretty much a minimal implementation and handles basic text only, though the paste buffer system is capable of passing much more complex entities around.



Selex ES Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

Jon Cooper

unread,
Aug 5, 2026, 6:08:45 PM (10 days ago) Aug 5
to fltk.general
*Sob* 13 years have gone by (that's almost a generation?) and I am using fltk-1.3.8 now and the default Fl_Input does not allow right-click pasting into it. Hence I still need Greg's tweaked one (from this discussion) if I want pasting to be a right-click thing. The middle-click paste works with the default Fl_Input though. I suppose it is whatever you the devs prefer. No major worries here. 

Ian MacArthur

unread,
Aug 7, 2026, 4:50:53 AM (9 days ago) Aug 7
to fltk.general
On Wednesday, 5 August 2026 at 23:08:45 UTC+1 jonathanbart wrote:
*Sob* 13 years have gone by (that's almost a generation?) and I am using fltk-1.3.8 now and the default Fl_Input does not allow right-click pasting into it. Hence I still need Greg's tweaked one (from this discussion) if I want pasting to be a right-click thing. The middle-click paste works with the default Fl_Input though. I suppose it is whatever you the devs prefer. No major worries here. 

Woah! That's a thread that's been dormant for a while...

FWIW, the FLTK interaction with the X11 cut/paste buffers and drag-and-drop has been poked about a bit in the intervening years and now handles rather more media types than just "plain text".
Though possibly not with 1.3.8 (which is getting a wee bit "long in the tooth" now...) so you might like to try 1.4.x, or even 1.5.x.
Don't think that resolves your right-click vs. middle-click issue however!

Reply all
Reply to author
Forward
0 new messages