class myUI : UIframe
{
  void generalFunction( object self , tagGroup checkTg )
  {
    // checkTg is the taggroup of the checkbox which fired the method.
    // Use its Title to get back the running value!

    string label = checkTg.DLGGetTitle()                
    Result( "\n label of checkbox:" + label )
    number i = val( right( label, len( label ) - 1 ) )   
    Result( "\n running index:" + i )
  }

  TagGroup CreateCheckboxes( object self )
  {
    TagGroup checkboxGroup = DLGCreateGroup()
    for ( number i = 0 ; I < 5 ; i++ )
    {
     checkboxGroup.DLGAddElement( DLGCreateCheckBox( "C" + I , 0 , "generalFunction" ) )
    }
    return checkboxGroup 
  }

  TagGroup CreateDLGTags( object self )
  {
    TagGroup dlg, dlgitems
    dlg = DLGCreateDialog( "Test" , dlgitems )
    dlgitems.DLGAddElement( self.CreateCheckboxes() )
    return dlg
  }

  object Init( object self )
  {
    return self.super.init( self.CreateDLGTags() )
  }
 }

// MAIN SCRIPT calling the dialog
{
  Object dlg = Alloc(myUI).Init()
  dlg.pose()
}