>
> > > > Is it possible to open or import a file, an image or text file from
> > > > anywhere other than the folder that the executable is located?
> > >
> > > Yes. Just give the appropriate path.
> > >
> > > What is it you are trying to do? What is happening?
> > >
> > >
> > >
> > I am trying to load an image into a box.  I have tried using various
> > file paths and have had no success with the image appearing in the box
> > except for if the image is in the same folder that the executable is in.
>
>
> That ought to Just Work - can you show us some minimal complete code that m=
> anifests the failure so we can see what you are doing wrong?
>
> Also, have you looked at the various examples (e.g. in the test folder of t=
> he tarball) or at Greg's cheat sheet ( http://www.seriss.com/people/erco/fl=
> tk/ ) to see what others have done?


Below is what I have done.  If I have the file with the executable it works.  I 
am trying to avoid embedding the image into the code because I don't want to 
significantly increase the amount of code that has to compile as it goes 
through the pictures values.  I have looked and haven't found anything yet that 
solves my issue.  So I decided to join up and ask myself.

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_BMP_Image.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Box.H>

void close_cb(Fl_Widget*, void*)
{
     exit(0);
}

int main ()
{
  Fl_Window *win;
  Fl_Box *box;
  Fl_Button *close;

  win = new Fl_Window (350, 300);
  win->begin();
  box = new Fl_Box (10, 10, 250, 250);
  box->box(FL_UP_BOX);
  close = new Fl_Button(200, 270, 50, 25, "Close");
  close->callback(close_cb);

  Fl_BMP_Image jpg("C:/Users/Marick/My Pictures/image.bmp");
  box->image(jpg);

  win->end ();
  win->show ();

  return(Fl::run());
}

_______________________________________________
fltk mailing list
fltk@easysw.com
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to