Baptiste wrote:is it possible with "FLTK" to create a listview with sorting by clicking on columns and selections of the elements of a line and color highlights.
You can use a Fl_Multi_Browser() as all other browsers it supports sorting order's row selection colums labels and so on ...
or you can use a Fl_Table or you build your own Fl_ListView (extends a Fl_GroupEx but this is more for advanced GUI coders).
Joshy
Code: Select all
#include once "fltk-c.bi"
' test of: Fl_Multi_BrowserNew()
sub BrowserCB cdecl(byval self as FL_WIDGET ptr,byval userdata as any ptr)
var brw = cptr(Fl_Browser ptr,self)
print "BrowserCB !"
end sub
'
' main
'
Fl_SetScheme("gleam")
var win = Fl_Double_WindowNew (800,400,"FL_MULTIBROWSER !")
var brw = Fl_Multi_BrowserNew(10,10,Fl_WidgetGetW(win)-20,Fl_WidgetGetH(win)-20)
Fl_Browser_SetHasScrollbar(brw,FL_SCROLL_BOTH)
Fl_WidgetSetCallbackArg(brw,@BrowserCB,0)
Fl_WidgetSetSelectionColor(brw,FL_RED)
dim as long widths(...)=>{80,100,120,70,0}
var nCols = ubound(widths)
var nRows = 50
Fl_BrowserSetColumnChar(brw,asc(","))
Fl_BrowserSetColumnWidths(brw,@widths(0))
Fl_BrowserAdd(brw,"Label 1,Label 2,Label 3,Label 4")
for r as integer = 1 to nRows
var sRow = "r:" & r
var sCols = ""
for c as integer = 1 to nCols
sCols &= sRow & " c:" & c & iif(c<nCols,",","")
next
Fl_BrowserAdd(brw,strptr(sCols))
next
Fl_GroupSetResizable(win,brw)
Fl_WindowShow(win)
Fl_Run()