|
|
On 2020-04-19 13:50, Anmol Mishra wrote:
> Hi. The load methods for both Fl_Browser and Fl_Browser require a file based input.
> I am linking FLKT into an app where I want to include a license file.
I'm not sure I'd use Fl_Browser for this purpose, among other things it interprets
characters like "@" as special codes for colors and fonts and such.
I have a commercial application that manages its own license files,
and the administration tool uses Fl_Text_Editor to display it, so that it looks
exactly like the original text, and people can copy/paste if need be.
If you want it to be 'read only' so the user can only view and not change
the contents, use Fl_Text_Display instead. Then they can still copy/paste
/from/ the widget, but not to it. Example:
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Text_Display.H>
int main() {
Fl_Window *win = new Fl_Window(640, 480);
Fl_Text_Buffer *buff = new Fl_Text_Buffer();
Fl_Text_Display *disp = new Fl_Text_Display(20, 20, 640-40, 480-40, "Display");
disp->buffer(buff);
win->resizable(*disp);
win->show();
buff->text("line 0\nline 1\nline 2\n"
"line 3\nline 4\nline 5\n"
"line 6\nline 7\nline 8\n"
"line 9\nline 10\nline 11\n"
"line 12\nline 13\nline 14\n"
"line 15\nline 16\nline 17\n"
"line 18\nline 19\nline 20\n"
"line 21\nline 22\nline 23\n");
return(Fl::run());
}
So in your case in place of buff->text("..."); you would just use:
buff->text(licenseData);
..instead.
That all said, if you want to use Fl_Browser, then I'd suggest making a small
function that breaks the string up into NULL terminated lines, and appends them
to the browser.
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/879b4a18-3c69-5598-b068-68c9de99267a%40seriss.com.
[ Direct Link to Message ] | |
|
| |