#193748 - 2009-05-11 08:38 AM
Using of Textboxes
|
Statler
Fresh Scripter
Registered: 2004-09-25
Posts: 11
|
Hi, is there anyone who could give me an example of using textboxes ? I´d like to know, how I could read out the content of a textbox.
Thank´s Statler
|
|
Top
|
|
|
|
#193759 - 2009-05-11 03:58 PM
Re: Using of Textboxes
[Re: Glenn Barnas]
|
Statler
Fresh Scripter
Registered: 2004-09-25
Posts: 11
|
That doesn´t really help :=((
In the complete manual (I´ve bought the whole kixforms manual) there´s no example of using a textbox. There is only a hint, that you can use it and which functions are added to it.
And the answer $text = $textbox1.text that seems not to be the main problem
To make it clear - here´s the main part of my test-script ___________________________________________________________ function f_Eingabe($E_Text) $Projekt.messagebox($E_Text,$E_Text,0) endfunction
function Start() $Schalter = $PROJEKT.controls.button("Berechnung durchführen") $Eingabe_1 = $PROJEKT.controls.textbox $Eingabe_1.SetFocus $Wert = $Eingabe_1.text $Schalter.onclick = f_Eingabe($Wert) endfunction _____________________________________________________
But it doesn´t work. At first, the messagebox appears without waiting to click on the buttom. And second, the variable $Wert is empty. Where is my mistake ?
Thank you for help
Thomas
|
|
Top
|
|
|
|
#193913 - 2009-05-18 09:56 AM
Re: Using of Textboxes
[Re: Shawn]
|
Statler
Fresh Scripter
Registered: 2004-09-25
Posts: 11
|
Hi Shawn,
it doesn´t work. Here is the whole script. I only want to know, how I can type some values in a (kix-)form and how to read the values out. Why doesn´t it work ?
setconsole ("hide") break on $PROJEKT = createobject("KIXTART.form") $PROJEKT.backcolor = &2CCD148 $PROJEKT.text = "Textbox" $PROJEKT.width = 660 $PROJEKT.height = 660 $PROJEKT.show
function f_Eingabe($E_Text) $Projekt.messagebox($E_Text,$E_Text,0) endfunction
function Start() $My_Button = $PROJEKT.controls.button("Calculate") $My_Button.top = 250 $My_Button.left = 175 $My_Button.width = 250 $My_Button.FontSize=14 $Input_1 = $PROJEKT.controls.textbox $Input_1.left = 430 $Input_1.top = 90 $Input_1.width = 70 $Input_1.FontSize = 14 $Input_1.SetFocus $My_Value = $Input_1.text $My_Button.onclick = f_Eingabe("$My_Value") endfunction
Start() while $PROJEKT.visible $=execute($PROJEKT.doevents) loop exit
Thank you for help
|
|
Top
|
|
|
|
#193915 - 2009-05-18 01:04 PM
Re: Using of Textboxes
[Re: Statler]
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Your logic and program flow is a bit mangled.
Try this to start with, when you have it working ask questions about why it is structured in the way that it is:
Break on
$=SetOption("NoVarsInStrings","ON")
$PROJEKT = createobject("KIXTART.form")
$PROJEKT.backcolor = &2CCD148
$PROJEKT.text = "Textbox"
$PROJEKT.width = 660
$PROJEKT.height = 660
$PROJEKT.show
; Create Input Box
$Input_1 = $PROJEKT.controls.textbox
$Input_1.left = 430
$Input_1.top = 90
$Input_1.width = 70
$Input_1.FontSize = 14
$Input_1.SetFocus
; Create action button
$My_Button = $PROJEKT.controls.button("Calculate")
$My_Button.top = 250
$My_Button.left = 175
$My_Button.width = 250
$My_Button.FontSize=14
; Assign action to button
$My_Button.onclick = "f_Eingabe($INPUT_1.text)"
while $PROJEKT.visible
$=execute($PROJEKT.doevents)
Loop
Exit 0
Function f_Eingabe($E_Text)
$Projekt.messagebox($E_Text,$E_Text,0)
Endfunction
|
|
Top
|
|
|
|
#193935 - 2009-05-19 04:48 PM
Re: Using of Textboxes
[Re: Richard H.]
|
Statler
Fresh Scripter
Registered: 2004-09-25
Posts: 11
|
Hi Richard, thank you very much. I found my mistakes or the problems. There are two things, that didn´t work: First I didn´t set the option NoVarsInStrings: $=SetOption("NoVarsInStrings","ON") Seems to be obligate in kix !??
And the second problem is $My_Value = $Input_1.text $My_Button.onclick = "f_Eingabe($My_Value)" it has to be used this way: My_Button.onclick = "f_Eingabe($Input_1.text)" although I think this second problem is a consecutive fault that appears by using the NoVarsInStrings-Option
So, thank you for your help.
Statler
Edited by Statler (2009-05-19 04:49 PM)
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1114 anonymous users online.
|
|
|