On 27.05.2011, at 17:22, anon wrote:

>> On 27/05/11 12:28, anon wrote:
>>> Hi!
>>> I've been having trouble figuring out how exactly I'm supposed to fetch the 
>>> filename/path string from said widget when my callback is invoked.
>>> I have been looking through the relevant headers for FileBrowser and 
>>> Browser classes and haven't succeded locating anything of interest.
>>> 
>> 
>> Hi,
>> 
>> Does the value() method not do what you're looking for? Inside the
>> FileChooser's callback:
>> 
>> void chooserCB(fltk::FileChooser* fc, void* v) {
>>  // code goes here
>>  puts(fc->value());
>>  // more code goes here
>> }
>> 
>> Hope this helps!
>> Ben
> 
> Thanks for the reply Ben. FYI I'm writing a barebone audio player.
> I want to use FileBrowser and not FileChooser. While I admittedly haven't 
> tried the latter I presume it is not meant to do what I want: have a 
> directory browser in the left side of a window and when an item (directory) 
> is selected, a Browser in the right side of the window shows a list of audio 
> files that are contained in the selected directory.
> 
> But, if I've misunderstood the roles of the two XxxBrowsers, then I'm 
> unavoidably led to wonder about the point of the FileBrowser; is the point to 
> fetch the index of selected item which is then passed to some 
> fltk::file_function() (I think, not sure, that I noticed some related 
> functions in the doc) to fetch the actual string(s) ?

FileChooser::value() returns the path and name of the file as a C-string. 

FileBrowser is a whole different beast. It is a (optionally) hierarchical 
display of files and directories. The easiest way to find out how it works is 
to look at the source code of FileChooser.cxx which uses a FileBrowser among 
other things.

But the FLTK 2 documentation is incomplete anyway and FLTK 2 is alpha. I 
recommend that you use FLTK 1.3.

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to