GIDForums  

Go Back   GIDForums > Computer Programming Forums > FLTK Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 05-Jul-2005, 08:16
jflisjak jflisjak is offline
New Member
 
Join Date: Jul 2005
Posts: 8
jflisjak is on a distinguished road

Fl_Help_View does not display images


Hi,

I am trying to display an HTML page with the Fl_Help_View object by using the load ( ) method. Only the the text is displayed and not the images (both JPEG, PNG, GIF images). Did someone already faced this issue?

Thanks in advance for your help.
Jean-Francois
  #2  
Old 05-Jul-2005, 09:39
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,109
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough
Quote:
Originally Posted by jflisjak
Hi,
Hello and Welcome to GIDForums!

Quote:
Originally Posted by jflisjak
I am trying to display an HTML page with the Fl_Help_View object by using the load ( ) method. Only the the text is displayed and not the images (both JPEG, PNG, GIF images). Did someone already faced this issue?

Thanks in advance for your help.
Jean-Francois

Looks like 1.1.x correct?

One thing I like to let people know. Make sure your FLTK is up to date. If you have subversion you can get the latest and greatest at the fltk.org site. If you don't have subversion you can get a snapshot or the stable 1.1.6 release but I think the subversion is actually a better choice. It's what will become 1.1.7 (if it hasn't already). Sometimes it matters what platform you are building for as well. At the very least, it won't hurt. We will need your working version though.

Take a look at the Posts for Help thread to get the most bang for your buck here.

As for your question, can you provided a small bit of test code that shows what you are talking about? Unless I am actually working on a project using the same fltk widgets you are the answers will suffer.

Ask away, that's why we are here.

Mark
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
  #3  
Old 06-Jul-2005, 00:38
jflisjak jflisjak is offline
New Member
 
Join Date: Jul 2005
Posts: 8
jflisjak is on a distinguished road
I am currently using FLTK 1.1.6 with Nano-X 0.91 and Linux 2.6.11.7.
You can find hereafter the source code used as example :

CPP / C++ / C Code:
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_GIF_Image.H>

static Fl_GIF_Image image_img1 ("/nfs/Images/img1.gif");

int main(int argc, char **argv) {
  Fl_Double_Window* w;
  { Fl_Double_Window* o = new Fl_Double_Window(640, 480);
    w = o;
    toto = new Fl_Help_View(5, 5, 630, 470);
    toto->load ("/nfs/FLTK.htm");

    { Fl_Box* o = new Fl_Box(315, 20, 150, 70);
      o->image(image_img1);
    }
    o->end();
  }
  w->show(argc, argv);
  return Fl::run();
}
Last edited by LuciWiz : 06-Jul-2005 at 11:00. Reason: Please insert your C++ code between [c++] & [/c++] tags
  #4  
Old 06-Jul-2005, 08:47
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,109
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough
Ok, now we can get somewhere. One thing, take a look at the thread Posts for Help which describes the code markup system among other things.

In short,

[c++]
// insert code here
[/c++]


Now, I modified your example a little to make things easier but now that I have done that I have a feeling your problem is a command line one. It took a while for the coffee to kick in. Make sure you use something similar to this.

Code:
g++ -Wall help_view_img.cpp `fltk-config --ldflags --cxxflags --use-images` -s -o HViewImg

Anyhow, here is your code with some modifications.

CPP / C++ / C Code:
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_GIF_Image.H>
#include <FL/Fl_Help_View.H>
#include <FL/Fl_Box.H>

static Fl_GIF_Image image_img1 ("cat_yawn.gif");

int main(int argc, char **argv) {

  Fl_Double_Window* MainWin = new Fl_Double_Window(640, 480);

    Fl_Help_View* toto = new Fl_Help_View(5, 85, 630, 390);
      toto->load ("Fl_GIF_Image.html");
  
    Fl_Box* abox = new Fl_Box(5, 5, 80, 80);
      abox->image(image_img1);

  MainWin->end();
  MainWin->show(argc, argv);
  return Fl::run();
}

This requires the gif and html to be in the same directory as your exe but that is easy enough to get around. I just didn't want to track down the raw materials and dumped them in my workdir. Below is a screen capture of the created program.



Hope this was what you were after.

Mark
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
  #5  
Old 06-Jul-2005, 09:57
jflisjak jflisjak is offline
New Member
 
Join Date: Jul 2005
Posts: 8
jflisjak is on a distinguished road
Thanks for your answer but I noticed that in your HTML file there is not image (please ignore the abox image in the exemple) but just text.

Anyway I tried with the following compilation line and it does not work (using my cross-compiler) :

arm-linux-g++ -msoft-float -I/nfs/fltk-1.1.6 toto.cxx -L/nfs/fltk-1.1.6/lib -lfltk -lfltk_images -lfltk_forms -L/nfs/nxlib045 -lX11 -L/nfs/jpeg-6b -ljpeg -L/nfs/libpng-1.2.8-config/.libs -lpng -L/nfs/zlib122 -lz `/nfs/fltk-1.1.6/fltk-config --cxxflags --use-images` -s -o help.exe

I still have no image displayed.
So I modified the Fl_Help_View code to manage JPEG images instead of Shared images and it works. But now I can read only JPEG images :-(
  #6  
Old 06-Jul-2005, 10:04
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,109
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough
You know, I was looking at your example after I posted it and had a feeling that was what you were talking about.

When you compiled fltk did you use --enable-localpng or something along those lines. Since you can use jpegs it seems odd. I'll find a page with png's on it and try it here and see what I come up with.

actually, make sure when you ./configure you have --enable-shared=yes as the default is no.

mark

EDIT:
OK, now I see what you are talking about. None of the png's (I used a savannah page) are being displayed.

D'oh, I forgot the simplest part.
CPP / C++ / C Code:
  MainWin->end();
  fl_register_images();
  MainWin->show(argc, argv);
  return Fl::run();

fl_register_images() is needed for the extra image types. Sorry for any confusion. It will now display the images inline properly. Well, as much as it does anyhow.
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
Last edited by cable_guy_67 : 06-Jul-2005 at 10:58.
  #7  
Old 07-Jul-2005, 00:52
jflisjak jflisjak is offline
New Member
 
Join Date: Jul 2005
Posts: 8
jflisjak is on a distinguished road
Ok, after adding the fl_register_images() call, images are correctly displayed inline.
Thanks a lot for your help.
  #8  
Old 07-Jul-2005, 02:23
jflisjak jflisjak is offline
New Member
 
Join Date: Jul 2005
Posts: 8
jflisjak is on a distinguished road
Just a last question : is there a way to change the font used to display the HTML file ?
  #9  
Old 07-Jul-2005, 05:29
cable_guy_67's Avatar
cable_guy_67 cable_guy_67 is offline
Senior Member
 
Join Date: Oct 2004
Location: Nescopeck, PA
Posts: 1,109
cable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the roughcable_guy_67 is a jewel in the rough
Quote:
Originally Posted by jflisjak
Just a last question : is there a way to change the font used to display the HTML file ?

I'm glad it works. I hadn't used help view for a bit so I can always use the practice. FLTK is a language of methods and derivations and I don't have a photographic memory.

Quote:
Originally Posted by www.fltk.org/documentation.php/doc-1.1/toc.html
void textfont(uchar f)
uchar textfont() const

The first form sets the default text font. The second returns the current default text font.

That link lives in a tab browser.

Mark
__________________
"Opportunity is missed by most people because it comes dressed in overalls and looks like work."
--Thomas Alva Edison
"Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety."
--Benjamin Franklin
"A happy person is not a person in a certain set of circumstances, but rather a person with a certain set of attitudes."
--Hugh Downs
  #10  
Old 07-Jul-2005, 06:40
jflisjak jflisjak is offline
New Member
 
Join Date: Jul 2005
Posts: 8
jflisjak is on a distinguished road
I am looking for something as follows :

void set_font (const char* font_filemame);
where font_filename is the font file that shall be used (e.g. "/nfs/fonts/arial.ttf").
 
 

Recent GIDBlogHalfway done! by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problems with a text display in a tab maveganzones FLTK Forum 2 23-Mar-2005 02:26
How do I display <filename>.bmp on the screen? oriharel MS Visual C++ / MFC Forum 1 01-Dec-2004 14:51
Unable to display images of BBS sugoiso Computer Software Forum - Windows 17 26-Oct-2004 12:35
uisng php to display php dopee MySQL / PHP Forum 6 14-May-2004 18:40
Why are my images distorted? rhino1616 Graphics Forum 0 27-Jun-2003 09:30

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 16:03.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.