#include once "fltk-c.bi"

'test of:
' Fl_Input, Fl_Int_Input, Fl_Float_Input with ENTER key callback
' Fl_Multiline_Input with any KEY callback


sub InputCB cdecl (self as Fl_Widget ptr, userdata as any ptr)
 ' note: you can replace self->AsAny with cptr(Fl_Input_ ptr,self)
 print "InputCB: " & *Fl_Input_GetValue(self->AsAny)
end sub

dim as Fl_Window ptr win = Fl_WindowNew(320,200)

' for this Fl_Input's we trigger an event callback for the ENTER key here (default is FL_WHEN_ENTER)
Fl_WidgetSetCallback Fl_InputNew      (120, 5,190, 20,"Fl_Input:")      ,@InputCB
Fl_WidgetSetCallback Fl_Int_InputNew  (120,30,190, 20,"Fl_Int_Input:")  ,@InputCB
Fl_WidgetSetCallback Fl_Float_InputNew(120,55,190, 20,"Fl_Float_Input:"),@InputCB

dim as Fl_Multiline_Input ptr mli = Fl_Multiline_InputNew(120,80,190,100,"Fl_Multiline_Input:")
Fl_WidgetSetCallback mli,@InputCB
' for the multiline_input we trigger an event callback for all changes
Fl_WidgetSetWhen mli,FL_WHEN_CHANGED

Fl_WindowShow win
Fl_Run