gambas InputBox

InputBox - это легкий в использовании класс, написанный в gambas.
Он предоставляет вам входное окно для получения некоторых данных от пользователя и возвращает в качестве результата строку.
sRet = Inputbox.run()



Syntax Parameters
inputbox.run(  
  OPTIONAL sTitle AS String = "InputBox"
  , OPTIONAL sLable AS String = ""
  , OPTIONAL sReturn AS String = ""
  , OPTIONAL aButton AS String[] = ["1"]
  , OPTIONAL aParams AS String[] =[""]
) AS String  





Parameters Default Value for aButton
1 [DefaultButton] "1" Which button will be activated if 'Enter' is pressed
2 [Button1.Text] "&OK" Any Button.Text for Button1
3 [Button2.Text] "&Cancel" Any Button.Text for Button2
4 [ReturnValueButton] "1" Which returns the Value
5 [Button1.ToolTip] "" Any Button.Tooltip for Button1
6 [Button2.ToolTip] "" Any Button.Tooltip for Button2



Parametes Default Value for aParams
1 [sComand] "" "FORCE" only a input who's like [sValidChars] will return a valide result.
"PW" for Password
2 [sValidChars] "" A Pattern of possible Chars or for "FORCE" the right word
3 [sFormat] "" Uses gambas Format$ to return the Inputvalue
4 [iMinChars] "0" Min. Chars to enter
5 [iMaxChars] "0" Max. Chars to enter


Example(s)
( This is the PUBLIC SUB Main() from the Starter.modul of the InputBox.class)

PUBLIC SUB Main()
DIM sReturn AS String
DIM sTitle AS String
DIM sLable AS String
DO WHILE sReturn <> "0"
sTitle ="choose InputBox Demo"
sLable =" 1 ) no parameters<BR> 2 ) forced use <br> 3) Password <br> 4) long lable text
<BR> 5) Numbers only<BR> 6) only Buttons<BR><BR> 9) InputBox HELP<BR> 0 ) quit"
sReturn = ""
sReturn= inputbox.Run(sTitle,sLable,sReturn,,["","01234569","","1","1"])
IF sReturn = "" THEN sReturn ="0"
SELECT CASE Val(sReturn)
CASE 1
sTitle =""
sLable =""
sReturn = ""
sReturn= inputbox.Run()
CASE 2
sTitle ="Format C:"
sLable ="type 'OK' to format your Windows Disk C:"
sReturn = ""
sReturn= inputbox.Run(sTitle,sLable,sReturn,,["FORCE","OK"])
CASE 3
sTitle ="Connecting to mySql"
sLable ="<B>Please enter your Password</B><BR><B> 6</B> chars min.<BR> <B>
8</B> chars max."
sReturn = ""
sReturn= inputbox.Run(sTitle,sLable,sReturn,,["PW","","",6,8])
CASE 4
sTitle ="Question"
sLable ="What's that strange thing here ?<BR><BR>a<BR><B>TextLable</B> <BR>with
<BR>many <BR>lines"
sReturn = "my gambas InputBox"
sReturn= inputbox.Run(sTitle,sLable,sReturn)
CASE 5
sTitle =" Numbers only"
sLable =" Numbers only ,<BR> but the Returnvalue is formated as '-#.00'"
sReturn = ""
sReturn= inputbox.Run(sTitle,sLable,sReturn,,["","0123456789.","-#.00"])
CASE 6
sReturn= inputbox.Run(,,"press a Button",["2","t&his","th&at","1",
"'this' is ReturnValueButton", "'that' it DefaultButton"])
CASE 9
sTitle ="InputBox HELP"
sLable ="type 'help' to display the InputBox HELP"
sReturn = "help"
sReturn= inputbox.Run(sTitle,sLable,sReturn,["1","&help","&exit","1",
"shows inputBox help","exit Inputbox"],["FORCE","help"])
END SELECT
IF sReturn <> "" THEN
IF sReturn <> "help" THEN
Message.Info("the returned Value = '" & sReturn & "'")
ELSE
SHELL "konqueror" & " " & Application.Path &/ "docu/inputBox.html"
ENDIF
ELSE
Message.Info("no Value returned")
ENDIF
LOOP
END

-- CharlieR - 29 Jul 2004


Attachment: Action: Size: Date: Who: Comment:
InputBox-0.0.2.tar.gz action 6072 29 Jul 2004 - 22:49 CharlieR Source