Page 1 of 1 1
Topic Options
#193748 - 2009-05-11 08:38 AM Using of Textboxes
Statler Offline
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
#193749 - 2009-05-11 08:48 AM Re: Using of Textboxes [Re: Statler]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
If you mean a textbox in kixforms then it is easy.

The textbox has a .text property so you can just do this:
 Code:
$text = $textbox1.text
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#193751 - 2009-05-11 12:50 PM Re: Using of Textboxes [Re: Statler]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4403
Loc: New Jersey
See www.kixforms.org for complete online documentation and a dedicated BBS.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#193759 - 2009-05-11 03:58 PM Re: Using of Textboxes [Re: Glenn Barnas]
Statler Offline
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
#193820 - 2009-05-13 02:40 PM Re: Using of Textboxes [Re: Statler]
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hi Thomas.

This line here:

$Schalter.onclick = f_Eingabe($Wert)

Should probably be like this:

$Schalter.onclick = 'f_Eingabe("$Wert")'

Let us know if this works better. If it does and need further discussion, we can discuss ...

-Shawn

Top
#193913 - 2009-05-18 09:56 AM Re: Using of Textboxes [Re: Shawn]
Statler Offline
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 Offline
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:
 Code:
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 Offline
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
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1336 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.059 seconds in which 0.026 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org