[Gambas-user] Return a String from a dialog/form

Marco Bauer elentirmo at ...20...
Tue Jul 19 14:54:57 CEST 2005


Hi everyone,

I tried to build a form which should return a string value to the main form 
when closed. I know this works with boolean values but with string values I 
get the runtime error "Type mismatched: wanted Integer, got String instead".

Did I completly mess up or what did I wrong? Can please somebody help me (you 
find attached the corresponding class-file and the call from the main form).

Thanks.
Marco


' Main file
...
  sNeuePosition = FInputPosition.Run(sPosition)
...

' Gambas class file
PUBLIC SUB _new(sPosition AS String)
  DIM sArray AS String[]
  
  sArray = Split(sPosition, " ")
  
  txtPosition.Text = sArray[0]
  spnAmZug.Value = CInt(sArray[1])
END

STATIC PUBLIC FUNCTION Run(sPosition AS String) AS String
  DIM hForm AS Form

  hForm = NEW FInputPosition(sPosition)
  RETURN hForm.ShowModal()
END

PUBLIC SUB btnCancel_Click()
  ME.Close(" ")
END

PUBLIC SUB btnOk_Click()
  IF PositionErlaubt() = TRUE THEN
    ME.Close(txtPosition.Text & " " & CStr(spnAmZug.Value))
  ELSE
    Message.Error("This is not a legal position! Please try again!")
  END IF
END

PRIVATE FUNCTION PositionErlaubt() AS Boolean
  RETURN TRUE
END




More information about the User mailing list