'IupListDialog Example in C

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

sub _init_ constructor
  IupOpen(0,0)
end sub

sub _exit_ destructor
  IupClose()
end sub

dim as integer error_ , size = 8 , marks(...) = { 0,0,0,0,1,1,0,0 }

dim as zstring ptr options(...) = {_
  @"Blue"   ,_
  @"Red"    ,_
  @"Green"  ,_
  @"Yellow" ,_
  @"Black"  ,_
  @"White"  ,_
  @"Gray"   ,_
  @"Brown"  }

error_ = IupListDialog(2,"Color Selection",size,@options(0),0,16,5,@marks(0))
If(error_ = -1) Then
  IupMessage("IupListDialog","Operation canceled")
Else
  Dim As ZString*80 selection
  For i As Integer= 0 To size-1
    If(marks(i)) Then
      Dim As ZString*10 temp
      sprintf(temp,!"%s\n",options(i))
      StrCat(selection,temp)
    End If
  Next
  If (StrCmp(selection,"")) Then
    IupMessage("Options selected",selection)
  Else
    IupMessage("IupListDialog","No option selected")
  EndIf
EndIf

