How to create and use multiple windows.
This is how I started, but the "Config" dlg does not have it's button shown.
The dialog itself shows, but not the enclosed button.
(PS. No weird undefined code this time.....LOL)
Code: Select all
#Include Once "fltk-c.bi"
Type ConfigDlg
As Fl_Window Ptr Win
As Fl_Button Ptr Setme
As Boolean CanExit 'exit sub flag
End Type
Sub SetConfig Cdecl (ByVal self As Fl_Widget Ptr, ByVal userdata As Any Ptr)
'user clicked "Set" button
Dim As ConfigDlg Ptr C = Cast(ConfigDlg Ptr, userdata)
C->CanExit = TRUE
End Sub
Sub DoConfig(ByRef P As ULong, ByRef C As UShort)
Dim As ConfigDlg Dlg
'
Dlg.Win = Fl_WindowNew(216, 123, "Configuration") 'Shows
Dlg.Setme = Fl_ButtonNew(132,105,57,15,"Set") 'DOES NOT SHOW
Print Dlg.SetMe
Fl_WidgetSetCallbackArg(Dlg.Setme, @SetConfig, @Dlg)
Fl_WindowEnd Dlg.Win
Fl_GroupSetResizable Dlg.Win, Dlg.Win
'
Fl_WindowShow Dlg.Win
'
'sit here and wait for set button click
While Dlg.CanExit = FALSE
Sleep 10
Wend
'
Fl_WindowHide(Dlg.Win) 'close dlg
End Sub
Function ButtonHandleCB Cdecl (ByVal self As Any Ptr,ByVal event As Fl_Event) As Long
Dim As ULong Plat
Dim As UShort Cfg
Select Case As Const event
Case FL_EVENT_PUSH
DoConfig(Plat, Cfg)
End Select
Return Fl_ButtonExHandleBase(self,event) ' don't eat the event
End Function
Dim As Fl_Window Ptr Win = Fl_WindowNew(320,200, "Main window")
Dim As Fl_ButtonEx Ptr Btn = Fl_ButtonExNew(10,10,320-20,200-20,"Config")
Fl_ButtonExSetHandleCB Btn,@ButtonHandleCB
Fl_WindowShow Win
Fl_Run