> That looks like it works on a callback, do you know if it is
> possible to have some clickable text as part of a label and
> when you click it,it opens an external page in an external browser.
Glib answer: yes.
Better answer: See the menubar_add sample in the examples folder.
Worked example:
/* fl_open_uri demo */
// fltk-config --compile uri_example.cxx
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Button.H>
#include <FL/filename.H> // fl_open_uri()
#include <FL/fl_draw.H> // fl_cursor
static Fl_Double_Window *main_win = (Fl_Double_Window *)0;
static Fl_Button *quit_bt = (Fl_Button *)0;
class uri_button: public Fl_Button {
int handle(int e);
public:
uri_button(int x, int y, int w, int h, const char *l = 0) :
Fl_Button
(x, y, w, h, l) {}
};
int uri_button::handle(int e) {
int result = Fl_Button::handle(e);
switch(e) {
case FL_ENTER:
fl_cursor(FL_CURSOR_HAND);
return 1;
case FL_LEAVE:
fl_cursor(FL_CURSOR_DEFAULT);
return 1;
default:
return result;
}
} // uri_button::handle
static uri_button *uri_bt = (uri_button *)0;
static void cb_uri_bt(Fl_Button*, void*) {
fl_open_uri("http://google.com/");
}
static void cb_quit_bt(Fl_Button*, void*) {
main_win->hide();
}
int main(int argc, char **argv) {
main_win = new Fl_Double_Window(326, 246, "URI test window");
main_win->begin();
uri_bt = new uri_button(100, 75, 105, 45, "Click Me!");
uri_bt->box(FL_FLAT_BOX);
uri_bt->labelsize(20);
uri_bt->labelcolor(FL_BLUE);
uri_bt->callback((Fl_Callback*)cb_uri_bt);
uri_bt->clear_visible_focus();
quit_bt = new Fl_Button(257, 212, 64, 27, "Quit");
quit_bt->callback((Fl_Callback*)cb_quit_bt);
main_win->end();
main_win->show(argc, argv);
return Fl::run();
}
/* end of file */
SELEX Galileo 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.
********************************************************************
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk