View previous topic :: View next topic |
Author |
Message |
Quinch KiXforms Novice

Joined: 29 Mar 2005 Posts: 1 Location: New Zealand
|
Posted: Mon Jul 21, 2008 7:37 pm Post subject: Clear default Text in Textbox |
|
|
Hello,
I have put default text in a couple TextBox Controls, these are instructional. I want to clear this text when the textbox gets focus. I want to use a generic function to do this.
Can I pass the control name to the function? Or do I determine what control has the current focus using a method?
Any help appreciated
Thanks _________________ If you and DEAD people know hex ....
How many people know hex? |
|
Back to top |
|
 |
Jochen KiXforms Devotee


Joined: 05 Mar 2003 Posts: 1204 Location: Stuttgart, Germany
|
Posted: Mon Jul 21, 2008 9:57 pm Post subject: |
|
|
Here is a simple sample that worked for me.
Caution: you will have to .Show the form before you create the TextBoxes, because if you do it vice versa all TextBoxes will gain focus 'programmacigally' and the text will vanish
Code: |
break on
$_ = setoption("NoVarsInStrings","ON")
dim $TextBox[10]
$system = createobject("Kixtart.System")
$form = $system.Form()
$form.Height = 400
$form.Text = "Use Tab to navigate..."
$form.Show
for $c = 0 to 9
$TextBox[$c] = $form.Controls.Add("TextBox")
$TextBox[$c].Width = 120
$TextBox[$c].Top = 5 + $c * 28
$TextBox[$c].OnGotFocus = '$TextBox['+$c+'].Text = ""'
$TextBox[$c].Text = "Insctructional Text #" + $c
next
while $form.Visible
$_ = execute($form.DoEvents)
loop
exit 1 |
Let us know if you can build on this or if you need more "advanced" tricks. _________________ Jochen
Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand. |
|
Back to top |
|
 |
|