Character in, character out. Which widget to choose?

11 views
Skip to first unread message

Hannu Vuolasaho

unread,
Jul 9, 2015, 9:42:31 PM7/9/15
to fltkg...@googlegroups.com
Hello!

I have Arduino network and I send data one character at a time. And I
want some kind of terminal for it.

I want add_blue(int ch) and add_yellow(int ch) to add character to the
end of line until \n comes and next line is created. When user hits
key, it is just send to Arduinos. No echo needed.

So far I've looked two widgets.

Fl_Text_Edit:

+ Easy to do based on dumb terminal emulator example
+ Copy and paste works as it should
+ Line wrapping
+ Easy save to file

- Formatting (Coloring each device) requires style buffer and trickery.
- In example cursor could be anywhere in widget (however in tty
example cheat behavior was what I prefer)

Fl_Multi_Browser:

+ @Style
+ No cursor to fail with
+ Line stuff can be easily implemented

- Only full lines can be selected
- handle() might become tricky

Have I missed something important or has someone good link to something similar?
How hairy task it would be to implement text selection for browser?
Is there any other way than style buffer to style output in
Fl_Text_Edit and how it can be set read only?

Best regards,
Hannu Vuolasaho

Greg Ercolano

unread,
Jul 9, 2015, 10:20:19 PM7/9/15
to fltkg...@googlegroups.com
On 07/09/15 18:42, Hannu Vuolasaho wrote:
> Have I missed something important or has someone good link to something similar?
> How hairy task it would be to implement text selection for browser?

It will do line selection already.

But it will not do per-character selection, and that would
probably be kinda hairy to add. To go that route, I think you'd
want to make a complete copy of the widget, change its name,
and then hack away at it.


> Is there any other way than style buffer to style output in
> Fl_Text_Edit

For coloring, the style buffer is the only way AFAIK.

The text editor is one of the more complicated widgets,
so it's typically nontrivial to add new features to it.

> and how it can be set read only?

Fl_Text_Display is the read only version of Fl_Text_Editor.
So just use that in place of Fl_Text_Editor, and it should
work the same, just not be user-editable.
Reply all
Reply to author
Forward
0 new messages