#include once "fltk-c.bi"

' test of:
' Fl_ScrollNew
' Fl_WidgetCopyLabel
' Fl_WidgetSetColorSel
' Fl_GroupSetResizable

dim as Fl_Window ptr win = Fl_WindowNew(640,480,"Fl_Scroll use the scrollbars")
' create a scrollable area (Fl_Scroll extendes Fl_Group)
dim as Fl_Scroll ptr scr = Fl_ScrollNew(0,0,Fl_WidgetGetW(win),Fl_WidgetGetH(win))
' create 100 buttons with random background and selection color
for y as integer = 0 to 39
  for x as integer = 0 to 39
    dim as string label = "[" & 1 + y*40 + x & "]"
    dim as zstring ptr p = strptr(label)
    dim as Fl_Button ptr btn = Fl_ButtonNew(x*50,y*50,45,45)
    Fl_WidgetCopyLabel btn, label
    Fl_WidgetSetColorSel(btn,Fl_RGB_Color(rnd*255,rnd*255,rnd*255), _
                             Fl_RGB_Color(rnd*255,rnd*255,rnd*255))
  next
next

Fl_GroupSetResizable win,scr
Fl_WindowSizeRange win,160,100,800,600
Fl_WindowShow win
Fl_Run()