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

On Keypress...

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


Joined: 18 Mar 2003
Posts: 158

PostPosted: Tue Aug 26, 2003 8:13 pm    Post subject: On Keypress... Reply with quote

Is there any way to use SendKeys or something like that to send a Tab whenever a '.' is typed into a textbox? I have 4 small textboxes to allow an IP to be typed into...Would be nice if it would Tab when a period is typed.

I did some searching through the HTML help file (very handy Exclamation ) and found the KeyCode property which helps...But unfortunately no value for the period key. Any help would be appreciated...

-Shane

_________________
-Shane
Back to top
View user's profile Send private message MSN Messenger
Jochen
KiXforms Devotee
KiXforms Devotee


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

PostPosted: Thu Aug 28, 2003 4:47 pm    Post subject: Reply with quote

Shane,

I won't send a key (TAB) to KiXforms , I'd rather try a SetFocus instead.

I bet you found already .AutoTab and .MaxLength for those IP thingies Wink

To get you started on the Keycode stuff :

Code:
break on

$f = createobject("KiXtart.Form")
$f.Size = 180,150
$f.Text = "Keycode Viewer"
$f.OnKeyDown = "$$t2.Text = $$f.KeyCode"

$l2 = $f.Label("Keycode:",60,30,80,20)
$t2 = $f.Label("",60,50,30,20)
$t2.Alignment = 2
$t2.BorderStyle = 5

$f.Show

while $f.Visible
    $=execute($f.DoEvents)
loop
exit 1

function form_KeyDown($k)
    $t2.Text = $k
endfunction


hth

_________________
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
Jochen
KiXforms Devotee
KiXforms Devotee


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

PostPosted: Sat Aug 30, 2003 11:56 am    Post subject: Reply with quote

Shane,

I couldn't resist as these saturdays in office are boring enough Cunning

How about this ?

Code:
break on

;========================= IP Input, AutoTab on period ===============================

$f = createobject("KiXtart.Form")

for $i = 1 to 4
    $_ = execute("$$t$i = $$f.TextBox('',$i*30,20,25,18)")
    $_ = execute("$$t$i.MaxLength = 3")
    $_ = execute("$$t$i.AutoTab = 1")
    $_ = execute("$$t$i.Alignment = 1")
    $_ = execute("$$t$i.OnKeyDown = 'IPSection_KeyDown($$i,$$$t$$i.KeyCode)'")
    if $i < 4
        $_ = execute("$$f.PrintXY($i*30+26,26,'.')")
    endif
next


$t1.SetFocus
$f.Show

while $f.Visible
    $_ = execute($f.DoEvents)
loop
exit 1

function IPSection_KeyDown($s, $key)
    if $s = 4 exit 1 endif
    if $key = 190
        $_ = execute("$$t$s.Text = left($$t$s.Text,len($$t$s.Text)-1)")
        $_ = execute("$$t" + $s+1 + ".SetFocus")
    endif
endfunction


Well, it needs some more IP-validation code but it does an AutoTab on period Nod

Hope this gets you started

_________________
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
sptomey
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 18 Mar 2003
Posts: 158

PostPosted: Mon Sep 01, 2003 7:24 pm    Post subject: Reply with quote

Made a couple of small changes...It now works with the autotab off as well.

Thanks for all the help. Wasn't too familiar with the execute function. I will get good at this kix stuff yet.

Code:
break on

;========================= IP Input, AutoTab on period ===============================

$f = createobject("KiXtart.Form")

for $i = 1 to 4
    $_ = execute("$$t$i = $$f.TextBox('',$i*30,20,25,18)")
    $_ = execute("$$t$i.MaxLength = 3")
    $_ = execute("$$t$i.AutoTab = 1")
    $_ = execute("$$t$i.Alignment = 1")
    $_ = execute("$$t$i.OnKeyDown = 'IPSection_KeyDown($$i,$$$t$$i.KeyCode)'")
    if $i < 4
        $_ = execute("$$f.PrintXY($i*30+26,26,'.')")
    endif
next


$t1.SetFocus
$f.Show

while $f.Visible
    $_ = execute($f.DoEvents)
loop
exit 1

function IPSection_KeyDown($s, $key)
    if $s = 4 exit 1 endif
    if $key = 190
        $_ = execute("$$last = right($$t$s.Text, 1)")
        if $last = "."
            $_ = execute("$$t$s.Text = left($$t$s.Text,len($$t$s.Text)-1)")
        endif
        $s = $s+1
        $_ = execute("$$t$s" + ".SetFocus")
    endif
endfunction

_________________
-Shane
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