KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Clear default Text in Textbox

 
Post new topic   Reply to topic    KiXforms Forum Index -> Starters Code Clinic
View previous topic :: View next topic  
Author Message
Quinch
KiXforms Novice
KiXforms Novice


Joined: 29 Mar 2005
Posts: 1
Location: New Zealand

PostPosted: Mon Jul 21, 2008 7:37 pm    Post subject: Clear default Text in Textbox Reply with quote

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
View user's profile Send private message
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Mon Jul 21, 2008 9:57 pm    Post subject: Reply with quote

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 Wink

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
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Starters Code Clinic All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group