#Include once "crt.bi"
#Include once "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

Dim As Ihandle Ptr dlg = IupColorDlg()

IupSetAttribute(dlg, "VALUE", "128 0 255")
IupSetAttribute(dlg, "ALPHA", "142")
IupSetAttribute(dlg, "SHOWHEX", "YES")
IupSetAttribute(dlg, "SHOWCOLORTABLE", "YES")
IupSetAttribute(dlg, "TITLE", "IupColorDlg Test")
IupSetCallback(dlg, "HELP_CB", Cast(Icallback,@help_cb))

IupPopup(dlg, IUP_CURRENT, IUP_CURRENT)

if (IupGetInt(dlg, "STATUS")) Then

  printf(!"OK\n")
  printf(!"COLOR(%s)\n", IupGetAttribute(dlg, "COLOR"))
  printf(!"COLORTABLE(%s)\n", IupGetAttribute(dlg, "COLORTABLE"))
Else
  printf(!"CANCEL\n")
end if

IupDestroy(dlg)

