Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Disabling Caps Lock key in Powerbuilder Application

Posted on 2004-04-20
7
Medium Priority
?
1,471 Views
Last Modified: 2013-12-26
I have several datawindows in which users enter data such as names.  I want to prevent them from using the Caps Lock key completely.  I attempted coding for a pbm_dwnkey event.  However, this only works when the user presses the Caps Lock key, not when it is "on".  I have considered annoying them by offering a correction using WordCap() every time a field is entered in all caps.  However, this would likely make some people pretty upset.  So, is this possible?
0
Comment
Question by:QueenKretee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 10871301
See links below:
Disabling a Keystroke in A DataWindow Control
http://www.sybase.com/detail?id=44465

Triggering the Print Screen Key and Other Keys Dynamically
http://www.sybase.com/detail?id=47760

regards-
0
 
LVL 18

Expert Comment

by:diasroshan
ID: 10875419
hi,

why do u want to disable caps lock...
...as i understand u want the user to enter only in lowercase...
...in that case why don't u set the edit properties of all ur column to lowercase (Case option)
Properties---> Edit----> Case .... to 'lower'

Cheers,
Rosh
0
 

Author Comment

by:QueenKretee
ID: 10877000
Rosh-
My users enter a lot of proper names.  Say we had Bob Smith.  I would want it just like this: Bob Smith.  Not bob smith or BOB SMITH.  I have considered using the WordCap() function.  However, then I may run into another problem...I get incorrect results with a name like McDonald.  Any other suggestions Rosh?
Cheers!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:QueenKretee
ID: 10877026
Namasi-
I see where we're going with the two suggestions that you made.  However, how can I tell when the user has the caps lock key "on"?  The dwnkey event only triggers when the key is pressed, not when the key is already "on".  Is there some other way of determining if caps lock is on or off?
Thank you in advance!
Kristi
0
 
LVL 15

Accepted Solution

by:
namasi_navaretnam earned 2000 total points
ID: 10877665
Kristi, Try these functions:

http://www.sybase.com/detail?id=44545

GetKeyboardState( ) & SetKeyboardState( )
The first function returns the present state of every key on the keyboard into an array of 256 integers based on the characters ASCII representation.  The second function sets the keyboard to the state given in the array.  A zero value represents that the key is not pressed.  There is no PowerBuilder equivalent.

Global External Function:
FUNCTION boolean GetKeyboardState(ref integer kbarray[256])  LIBRARY "USER32.DLL"
FUNCTION boolean SetKeyboardState(ref integer kbarray[256]) LIBRARY "USER32.DLL"
Function ulong GetDC(ulong hwnd) library "user32.dll"

Script:
//GetKeyboardState( )
boolean rtn
integer ipkey[256]
rtn = GetKeyboardState(ipkey)

//SetKeyboardState( )
rtn = SetKeyboardState(ipkey)
if rtn = false then
 Messagebox("Failed","Something went wrong when loading into array")
else
 Messagebox("Successful","Keyboard state is loaded back into buffer")
end if
 

GetKeyState( )
This function returns the present state of a specific key on the keyboard based on that key's ASCII representation.  A zero value represents that the key is not pressed.  There is no PowerBuilder equivalent.

Global External Function:
Function int GetKeyState(integer VirtualKeycode) Library "User32.dll"

Script:
int rtn
rtn = GetKeyState(65)  // 65 = A
if rtn = 0 then
 MessageBox("Key State","Letter 'A' not pressed!")
else
 MessageBox("Key State","Letter 'A'  is pressed!")
end if


regards-
0
 

Author Comment

by:QueenKretee
ID: 10877981
Thank you very much Namasi.  Great information! Very Helpful.
0
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 10878263
Glad to help!!!

Namasi Navaretnam
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question