> Hi,
>
> I use a Fl_Scroll widget with BOTH type defined.
>

The key is to know that Fl_Scroll has two public member Fl_Scrollbar objects, 
scrollbar and hscrollbar, and to get info about these two members you can call 
their methods directly.  Seems like this information is only implied in the 
documentation here: http://www.fltk.org/doc-1.1/Fl_Scroll.html#Fl_Scroll
But you can find the information by looking in the source code of course.

> - How can I know when both scrollbars are displayed (is there any function) ?

You can use scrollbar.visible() and hscrollbar.visible(), for the vertical and 
horizontal scrollbars respectively.

> - How can I get the width/thickness of the sliders ?

You can use scrollbar.w() for the thickness of the slider of the vertical 
scrollbar, and you can use hscrollbar.h() for the thickness of the slider of 
the horizontal scrollbar.

The following example demonstrates :

#include <FL/Fl.h>
#include <FL/Fl_Window.h>
#include <FL/Fl_Button.h>
#include <FL/Fl_Scroll.h>
#include <iostream>
Fl_Scroll *s1;
Fl_Window *w;
void cb(Fl_Widget *b,void *d){

if(b->w()==200)
b->size(100,100);
else
b->size(200,200);
w->redraw();
Fl::flush();
if(s1->scrollbar.visible()&&s1->hscrollbar.visible()){
std::cout << "both visible\n";
std::cout << "scrollbar thickness is: " << s1->scrollbar.w() << " : " << 
"horizontal scrollbar thickness : " << s1->hscrollbar.h() << "\n";
}

else if(!(s1->scrollbar.visible()&&s1->hscrollbar.visible()))
std::cout << "neither visible\n";

}

int main(void){
w=new Fl_Window(0,0,200,200);
s1=new Fl_Scroll(0,0,200,200);
Fl_Button b(20,20,200,200,"Resize me");
b.callback(cb);
s1->end();
w->end();
w->show();
return Fl::run();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to