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

CAPSlock On/Off CHECK and CHANGE

 
Post new topic   Reply to topic    KiXforms Forum Index -> Discussion
View previous topic :: View next topic  
Author Message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Mon Aug 08, 2005 3:15 pm    Post subject: CAPSlock On/Off CHECK and CHANGE Reply with quote

I can easily see if a key pressed is CAPSLOCK by keycode 20 however how do we check to see if it is already on and how could we turn it on/off without actually pressing the key ?
I want to force it ON while filling in a form and off when finished however I am not sure where to start ?
Question Is the CAPSLOCK state a registry value ?
________
Magic flight


Last edited by MACE1 on Fri Feb 18, 2011 5:05 pm; edited 1 time in total
Back to top
View user's profile Send private message
Les
KiXforms Aficionado
KiXforms Aficionado


Joined: 24 Dec 2003
Posts: 317

PostPosted: Mon Aug 08, 2005 3:26 pm    Post subject: Reply with quote

What if the user toggles it after you set it? Would it not be better to convert what they entered instead?

You can check the state with the SetCapsLock() UDF over at www.kixtart.org.

_________________
The Repro Man
Stealing for a living!
Back to top
View user's profile Send private message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Mon Aug 08, 2005 4:16 pm    Post subject: Reply with quote

Laughing
Will have a look see...
I do parse what is typed using #.OnKeyDown
but for ease of User input it helpes to start off in CAPS.
________
Kmart Gift Cards


Last edited by MACE1 on Sat Mar 12, 2011 5:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Mon Aug 08, 2005 4:37 pm    Post subject: NOt quite what I expected... Reply with quote

Code:

Function SetCapsLock(optional $state)
Dim $,$l,$sASCIIState
$PreviousState = SetOption('ASCII')
$sASCIIState = SetOption('ASCII','On')
$SK=SendKeys('L')
Get $L
Select
Case $L=='L'
$SetCapsLock='off'
If $state="on"
 $SK=SendKeys('{CAPSLOCK}')
EndIf
Case $L=='l'
$SetCapsLock='on'
If $state='off'
 $SK=SendKeys('{CAPSLOCK}')
EndIf
EndSelect
$sASCIIState=SetOption("ASCII",$sASCIIState)
Exit 0
EndFunction


Nice little UDF. looks to me it Sends to Keyboard Buffer using $SK=SendKeys('L') then read it back with Get $L and checks if uppercase or not.
________
EXPERT INSURANCE


Last edited by MACE1 on Sat Mar 12, 2011 5:32 pm; edited 1 time in total
Back to top
View user's profile Send private message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Mon Aug 08, 2005 4:48 pm    Post subject: Too good to be true Reply with quote

The GET still requires actual user input so of no use to me.. oh well, will keep looking.
________
Suzuki fronte


Last edited by MACE1 on Fri Feb 18, 2011 5:05 pm; edited 1 time in total
Back to top
View user's profile Send private message
Les
KiXforms Aficionado
KiXforms Aficionado


Joined: 24 Dec 2003
Posts: 317

PostPosted: Mon Aug 08, 2005 8:20 pm    Post subject: Reply with quote

Huh??? But you said "I want to force it ON while filling in a form" so that too would require user input.
_________________
The Repro Man
Stealing for a living!
Back to top
View user's profile Send private message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Tue Aug 09, 2005 9:30 am    Post subject: Reply with quote

Exclamation
The data in the form is parsed when they press enter, all illegal characters, spaces etc formatted as required and all turned to caps.
To give the user a better feel for what they should be typing I want to let them type in caps, for one thing the spacing is different.
Would never rely on a user to actually press CAPS LOCK.
My UDF for real time parsing has too much of an overhead to parse every key press for a large form, far too much flicker, so I have opted to parse when they press enter or tab or change focus.
If I can determine that CAPS is on at the start of the form, if they press it again I will know and be able to reset it to ON. The difficulty is setting the state in the first place. Where is the flag set ?
________
[URL=http://www.ferrari-wiki.com/wiki/Pedro_Rodr?guez_(racing_driver)]Pedro rodr?guez (racing driver)[/URL]


Last edited by MACE1 on Fri Feb 18, 2011 5:05 pm; edited 1 time in total
Back to top
View user's profile Send private message
Les
KiXforms Aficionado
KiXforms Aficionado


Joined: 24 Dec 2003
Posts: 317

PostPosted: Tue Aug 09, 2005 1:32 pm    Post subject: Reply with quote

Not knowing anything about your form, I cannot say for certain, but if you could have one short field as the first one users fill in the tab order, just check the capslock state on that one and assume that they don't toggle the state after that.
_________________
The Repro Man
Stealing for a living!
Back to top
View user's profile Send private message
Chris S.
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 05 Mar 2003
Posts: 241

PostPosted: Tue Aug 09, 2005 4:32 pm    Post subject: Reply with quote

Why not something like...

Code:

$System = CreateObject("Kixtart.System")

$Form = $System.Form()

$Form.Textbox1 = $Form.Textbox()
$Form.Textbox1.Dock = 5
$Form.Textbox1.OnKeyDown = "fnOnKeyDown()"
 
$Form.Show
While $Form.Visible
 $=Execute($Form.DoEvents)
Loop

Exit 1

Function fnOnKeyDown()
   $Form.Textbox1.SelectionLength = Len($Form.Textbox1.Text)
   $Form.Textbox1.Text = UCASE($Form.Textbox1.Text)
   $Form.Textbox1.SelectionStart = Len($Form.Textbox1.Text)
EndFunction
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 -> Discussion 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