class Fl_Browser : public Fl_Browser_

The Fl_Browser displays a scrolling list of text lines, and manages all the storage for the text. This is not a text editor or spreadsheet! But it is useful for showing a vertical list of named objects to the user.

Each line in the browser is identified by number. The numbers start at one (this is so that zero can be reserved for "no line" in the selective browsers). Unless otherwise noted, the methods do not check to see if the passed line number is in range and legal. It must always be greater than zero and <= size().

Each line contains a null-terminated string of text and a void* data pointer. The text string is displayed, the void* pointer can be used by the callbacks to reference the object the text describes.

The base class does nothing when the user clicks on it. There are subclasses that react to user clicks to select lines in the browser and do callbacks:

There is a base class called Fl_Browser_. This provides the scrolling and selection mechanisms of this and all the subclasses, but the dimensions and appearance of each item are determined by the subclass. You can use Fl_Browser_ to display information other than text, or text that is dynamically produced from your own data structures. If you find that loading the browser is a lot of work or is inefficient, you may want to make a subclass of Fl_Browser_.

Fl_Browser::Fl_Browser(int, int, int, int, const char * =0);

void Fl_Browser::add(const char*, void* = 0);

void Fl_Browser::remove(int n);

void Fl_Browser::insert(int n, const char*, void* = 0);

void Fl_Browser::move(int to, int from);

void Fl_Browser::clear();

int Fl_Browser::load(const char *filename);

int Fl_Browser::size() const ;

const char* Fl_Browser::text(int n) const ;

void Fl_Browser::text(int n, const char*);

void* Fl_Browser::data(int n) const ;

void Fl_Browser::data(int n, void*);

void Fl_Browser::show(int n);
void Fl_Browser::hide(int n);
int Fl_Browser::visible(int n) const ;

int Fl_Browser::topline() const ;
void Fl_Browser::topline(int);

int Fl_Browser::position() const ;
void Fl_Browser::position(int);

Fl_Font Fl_Browser::textfont() const ;
void Fl_Browser::textfont(Fl_Font);
uchar Fl_Browser::textsize() const ;
void Fl_Browser::textsize(uchar);
Fl_Color Fl_Browser::textcolor() const ;
void Fl_Browser::textcolor(Fl_Color);

uchar Fl_Browser::column_char() const ;
void Fl_Browser::column_char(char);

const int* Fl_Browser::column_widths() const ;
void Fl_Browser::column_widths(const int*);

uchar Fl_Browser::format_char() const ;
void Fl_Browser::format_char(char);

void Fl_Browser_::has_scrollbar(int);

void Fl_Browser_::scrollbar.align(int);

Fl_Scrollbar& Fl_Browser_::scrollbar;
Fl_Scrollbar& Fl_Browser_::hscrollbar;


class Fl_Select_Browser : public Fl_Browser

This is a subclass of Fl_Browser which lets the user click on an item. As long as the mouse button is held down the item pointed to by it is highlighted. The highlight goes away when the mouse is released. Normally the callback is done when the user releases the mouse, but you can change this with when().

See Fl_Browser for methods to add and remove lines from the browser.

Fl_Select_Browser::Fl_Select_Browser(int x,int y,int w,int h,const char *l)

Constructor.

Fl_When Fl_Widget::when() const;
void Fl_Widget::when(Fl_When);

Controls when callbacks are done. The following values work, the default value is FL_WHEN_RELEASE:

int Fl_Browser::value() const ;

Return the number of the highlighted item, or zero if none. Notice that this is going to be zero except during a callback!

int Fl_Browser::select(int, int=1);
void Fl_Browser::value(int) ;
int Fl_Browser::deselect();
int Fl_Browser::selected(int) const ;

You can use these for compatibility with the Fl_Multi_Browser. However if you turn on the selection of a line the results are unpredictable.

class Fl_Hold_Browser : public Fl_Browser

This is a subclass of Fl_Browser which lets the user select a single item, or no items by clicking on the empty space. As long as the mouse button is held down the item pointed to by it is highlighted, and this highlighting remains on when the mouse button is released. Normally the callback is done when the user releases the mouse, but you can change this with when().

See Fl_Browser for methods to add and remove lines from the browser.

Fl_Hold_Browser::Fl_Hold_Browser(int x,int y,int w,int h,const char *l)

Constructor.

Fl_When Fl_Widget::when() const;
void Fl_Widget::when(Fl_When);

Controls when callbacks are done. The following values are useful, the default value is FL_WHEN_RELEASE:

int Fl_Browser::value() const ;
void Fl_Browser::value(int) ;

Set or get which line is selected. This returns zero if no line is selected, be aware that this can happen in a callback.

int Fl_Browser::deselect();

Same as Fl_Browser::value(0).

int Fl_Browser::select(int,int=1);
int Fl_Browser::selected(int) const ;

You can use these for compatibility with the Fl_Multi_Browser. However if you turn on the selection of more than one line the results are unpredictable.

class Fl_Multi_Browser : public Fl_Browser

This is a subclass of Fl_Browser which lets the user select any set of the lines. The user interface is Macintosh style: clicking an item turns off all the others and selects that one, dragging selects all the items the mouse moves over, and shift + click toggles the items. This is different then how forms did it. Normally the callback is done when the user releases the mouse, but you can change this with when().

See Fl_Browser for methods to add and remove lines from the browser.

Fl_Multi_Browser::Fl_Multi_Browser(int x,int y,int w,int h,const char *l)

Constructor.

Fl_When Fl_Widget::when() const;
void Fl_Widget::when(Fl_When);

Controls when callbacks are done. The following values are useful, the default value is FL_WHEN_RELEASE:

int Fl_Browser::value() const ;

The line number that has most recently changed state.

void Fl_Browser::value(int) ;

Set this to select only one line and turn off all the others.

int Fl_Browser::deselect();

Turn off the selection on all lines.

int Fl_Browser::select(int, int=1);
int Fl_Browser::selected(int) const ;

Set or get the selection on a single line.