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 27-May-2005, 07:23
Acki Acki is offline
New Member
 
Join Date: Jan 2005
Posts: 27
Acki is on a distinguished road

File chooser


Hi,
I want to select multiple files with the file_choose.
I did it like this:

CPP / C++ / C Code:
use_system_file_chooser(true);
.
.
.
file_chooser("Select files", "all files (*.*)\0*.*\0\0", NULL, false);

It works for selecting one file, but how to select more ???
I'm using FLTK2 under Win2K...

I tried it also like this:

CPP / C++ / C Code:
FileChooser fc("dir", "*.*", 0, "titel");
fc.type(1);
fc.exec();

this way I can select multiple files, but don't get them when clicking on "OK" !!!
And it's not the window's file chooser but the FLTK's file chooser (I want the window's chooser)...

How can I select more than one file ???

thx, Acki
  #2  
Old 07-Feb-2006, 19:09
rbp rbp is offline
Junior Member
 
Join Date: Nov 2005
Location: Melbourne, Australia
Posts: 67
rbp will become famous soon enough

Re: file chooser


I'm sure Acki has moved on in the last 9 months; but for other peoples benefit the file_chooser function returns a pointer to the filename selected, or NULL: http://www.fltk.org/doc-1.1/function..._file_chooser2

The file_chooser class however is more flexible: http://www.fltk.org/doc-1.1/Fl_File_...l_File_Chooser

This is the constructor:
CPP / C++ / C Code:
Fl_File_Chooser(const char *pathname, const char *pattern, int type, const char *title)

Here's an example to select multiple files (I think I adapted this from one of erco's examples: http://seriss.com/people/erco/fltk/):

CPP / C++ / C Code:
Fl_File_Chooser chooser( ".", "Image Files (*.{gif,jpg,jpeg,bmp,png,tif})", Fl_File_Chooser::MULTI, "Please select image" );                 
chooser.show();

// block until user picks something.
while( chooser.shown() ) { Fl::wait(); }

// display filenames selected - index starts from 1
for( unsigned int i=1; i <= chooser.count(); i++ )
    cerr << chooser.value(i) << endl;
  #3  
Old 08-Apr-2006, 06:30
McSmythe McSmythe is offline
New Member
 
Join Date: Feb 2006
Posts: 3
McSmythe is on a distinguished road

Re: file chooser


Thanks for the Fl_File_Chooser example! I was just trying to use it and couldn't figure out how to get the filename as easily as you showed. Didn't know about shown().
  #4  
Old 22-Apr-2006, 04:50
rbp rbp is offline
Junior Member
 
Join Date: Nov 2005
Location: Melbourne, Australia
Posts: 67
rbp will become famous soon enough

Re: file chooser


glad it was useful for someone!
Richard
  #5  
Old 05-Jul-2007, 01:10
krey krey is offline
New Member
 
Join Date: Jul 2007
Posts: 7
krey is on a distinguished road

Re: file chooser


hello!
i tried to add file_chooser in code, but at linking step i obtain an error:
Quote:
[Linker error] undefined reference to `AlphaBlend@44'
AlphaBlend is from wingdi library. First quetion - where file_chooser may use wingdi???
adding -lgdi32 option for linker do not solve this problem. How i can eliminate this error?
thanx
  #6  
Old 05-Jul-2007, 04:50
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

Re: file chooser


My guess is you need to link to the fltk images lib. If you are using fltk-config add --use-images and all will be well.

If you search this forum you for --use-images you should find the way to link it otherwise. When in doubt, I just run from the command line,

Code:
fltk-config --ldflags --use-images

Here is a sample,
Code:
$ fltk-config --ldflags -L/usr/local/lib -mwindows -lfltk -lpthread -lole32 -luuid -lcomctl32 -lwsock32 $ fltk-config --ldflags --use-images -L/usr/local/lib -mwindows -lfltk_images -lfltk_png -lfltk_z -lfltk_jpeg -lfltk -lpthread -lole32 -luuid -lcomctl32 -lwsock32

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
  #7  
Old 06-Jul-2007, 00:57
krey krey is offline
New Member
 
Join Date: Jul 2007
Posts: 7
krey is on a distinguished road

Re: file chooser


i dont use fltk-config. I compile with Dev-Cpp. And i want to use fltk2, not fltk 1.1.x
adding --use-images key do not solve this problem
  #8  
Old 06-Jul-2007, 01:20
krey krey is offline
New Member
 
Join Date: Jul 2007
Posts: 7
krey is on a distinguished road

Re: file chooser


problem solved by adding library
-lmsimg32
thank u
  #9  
Old 27-Jul-2007, 06:20
TommesI TommesI is offline
New Member
 
Join Date: Mar 2007
Posts: 5
TommesI is on a distinguished road
Unhappy

Re: file chooser


Hey,
I'm using FLTK2 on Win32 (XP) and would like to have the native System File Chooser instead of the FLTK file chooser. I tried the following:
CPP / C++ / C Code:
fltk::use_system_file_chooser(true);
fltk::file_chooser("Open file", NULL, NULL);
But when I compile my application an error occurs:

CPP / C++ / C Code:
error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl fltk::use_system_file_chooser(bool)"
Did I forget an include library or did I disregard anything else?
Any advices appreciated!
  #10  
Old 27-Jul-2007, 08:42
Acki Acki is offline
New Member
 
Join Date: Jan 2005
Posts: 27
Acki is on a distinguished road

Re: file chooser


hmm, strange, it works for me (same system WinXP sp2)...
did you link against libfltk_s.a ???
 
 

Recent GIDBlogVista ?Widgets? on Windows XP by LocalTech

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
Airport Log program using 3D linked List : problem reading from file batrsau C Programming Language 11 29-Feb-2008 07:44
CD burner wont burn!! robertli55 Computer Hardware Forum 1 18-Jun-2004 10:53
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 11:28
Re: Programming Techniques WaltP C Programming Language 0 09-Mar-2004 23:56

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

All times are GMT -6. The time now is 19:45.


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