#Include "crt.bi"
#Include "inc/iup.bi"


sub _init_ constructor
  IupOpen(0,0)
end sub

sub _exit_ destructor
  IupClose()
end sub

Function help_cb cdecl()as Integer
	return IUP_CLOSE
End Function

'
' main
'
Dim As Ihandle Ptr dlg = IupFileDlg()
IupSetAttribute(dlg, "DIALOGTYPE", "OPEN")
IupSetAttribute(dlg, "TITLE", "IupFileDlg Test")
IupSetAttributes(dlg, !"FILTER =\"*.bmp\", FILTERINFO=\"Bitmap Files\"")
IupSetCallback(dlg, "HELP_CB", cast(Icallback,@help_cb))
IupPopup(dlg, IUP_CURRENT, IUP_CURRENT)

if (IupGetInt(dlg, "STATUS")) then
  printf(!"OK\n")
  printf(!"VALUE(%s)\n", IupGetAttribute(dlg, "VALUE"))
else
  printf(!"CANCEL\n")
end if

IupDestroy(dlg)

IupClose()
