<http://forum.pspad.com/read.php?f=2&i=12481&t=12435> 
----------------------------------------------------------------

Hello,

thanks for the help, I decided to stick with the ugly but simple solution
(so simple I couldn't see myself), as I want it portable (f.e. to use
also at work) and "cutting edge" seems to require a bit system setup.

Here's my version (where options is an array of descriptions and the
value returned is the array index, or -1 if answer was wrong or
cancelled):

Function choice(text, options)
   choice = -1
   If (IsArray(options) And (UBound(options) >= 0)) then
      text = text & vbNewLine
      For i = 0 To UBound(options)
         text = text & vbNewLine & (i + 1) & ": " & options(i)
      Next 
      Dim input
      input = InputBox(text, module_name)
      If (IsNumeric(input)) Then
         input = CInt(input)
         If ((input > 0) And (input < (UBound(options) + 2))) Then
            choice = input - 1
         End If 
      End If
   End If
End Function

Thanks,
Thorsten

-- 
PSPad freeware editor http://www.pspad.com

Reply via email to