Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » GetNumLock and GetScrollLock functions [FEATURE REQUEST]
GetNumLock and GetScrollLock functions [FEATURE REQUEST] [message #14770] Fri, 14 March 2008 09:33 Go to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Hi,

Please add GetNumLock and GetScrollLock functions to CtrlCore package. The required code for Windows is here:

CtrlCore.h:
...
#ifdef PLATFORM_WIN32
#ifdef PLATFORM_WINCE
bool GetShift();
bool GetCtrl();
bool GetAlt();
bool GetCapsLock();
bool GetNumLock();		// Added by Tom
bool GetScrollLock();		// Added by Tom
bool GetMouseLeft();
bool GetMouseRight();
bool GetMouseMiddle();
#else
inline bool GetShift()       { return !!(GetKeyState(VK_SHIFT) & 0x8000); }
inline bool GetCtrl()        { return !!(GetKeyState(VK_CONTROL) & 0x8000); }
inline bool GetAlt()         { return !!(GetKeyState(VK_MENU) & 0x8000); }
inline bool GetCapsLock()    { return !!(GetKeyState(VK_CAPITAL) & 1); }
inline bool GetNumLock()     { return !!(GetKeyState(VK_NUMLOCK) & 1); }	// Added by Tom
inline bool GetScrollLock()  { return !!(GetKeyState(VK_SCROLL) & 1); }		// Added by Tom
inline bool GetMouseLeft()   { return !!(GetKeyState(VK_LBUTTON) & 0x8000); }
inline bool GetMouseRight()  { return !!(GetKeyState(VK_RBUTTON) & 0x8000); }
inline bool GetMouseMiddle() { return !!(GetKeyState(VK_MBUTTON) & 0x8000); }
#endif
#endif

#ifdef PLATFORM_X11
bool GetShift();
bool GetCtrl();
bool GetAlt();
bool GetCapsLock();
inline bool GetNumLock(){ return false; }	// Added by Tom
inline bool GetScrollLock(){ return false; }	// Added by Tom
bool GetMouseLeft();
bool GetMouseRight();
bool GetMouseMiddle();
...



Win32Proc.cpp:
...
#ifdef PLATFORM_WINCE

bool GetShift() { return false; }
bool GetCtrl() { return false; }
bool GetAlt() { return false; }
bool GetCapsLock() { return false; }
bool GetNumLock() { return false; }	// Added by Tom
bool GetScrollLock() { return false; }	// Added by Tom

bool wince_mouseleft;
bool wince_mouseright;
...


I do not seem to be able to figure out how to do it in X, but I guess somebody else can...

// Tom
Re: GetNumLock and GetScrollLock functions [FEATURE REQUEST] [message #14776 is a reply to message #14770] Fri, 14 March 2008 14:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Fri, 14 March 2008 04:33

Hi,

Please add GetNumLock and GetScrollLock functions to CtrlCore package. The required code for Windows is here:

CtrlCore.h:
...
#ifdef PLATFORM_WIN32
#ifdef PLATFORM_WINCE
bool GetShift();
bool GetCtrl();
bool GetAlt();
bool GetCapsLock();
bool GetNumLock();		// Added by Tom
bool GetScrollLock();		// Added by Tom
bool GetMouseLeft();
bool GetMouseRight();
bool GetMouseMiddle();
#else
inline bool GetShift()       { return !!(GetKeyState(VK_SHIFT) & 0x8000); }
inline bool GetCtrl()        { return !!(GetKeyState(VK_CONTROL) & 0x8000); }
inline bool GetAlt()         { return !!(GetKeyState(VK_MENU) & 0x8000); }
inline bool GetCapsLock()    { return !!(GetKeyState(VK_CAPITAL) & 1); }
inline bool GetNumLock()     { return !!(GetKeyState(VK_NUMLOCK) & 1); }	// Added by Tom
inline bool GetScrollLock()  { return !!(GetKeyState(VK_SCROLL) & 1); }		// Added by Tom
inline bool GetMouseLeft()   { return !!(GetKeyState(VK_LBUTTON) & 0x8000); }
inline bool GetMouseRight()  { return !!(GetKeyState(VK_RBUTTON) & 0x8000); }
inline bool GetMouseMiddle() { return !!(GetKeyState(VK_MBUTTON) & 0x8000); }
#endif
#endif

#ifdef PLATFORM_X11
bool GetShift();
bool GetCtrl();
bool GetAlt();
bool GetCapsLock();
inline bool GetNumLock(){ return false; }	// Added by Tom
inline bool GetScrollLock(){ return false; }	// Added by Tom
bool GetMouseLeft();
bool GetMouseRight();
bool GetMouseMiddle();
...



Win32Proc.cpp:
...
#ifdef PLATFORM_WINCE

bool GetShift() { return false; }
bool GetCtrl() { return false; }
bool GetAlt() { return false; }
bool GetCapsLock() { return false; }
bool GetNumLock() { return false; }	// Added by Tom
bool GetScrollLock() { return false; }	// Added by Tom

bool wince_mouseleft;
bool wince_mouseright;
...


I do not seem to be able to figure out how to do it in X, but I guess somebody else can...

// Tom


Well, but what is the point, if we cannot do it in X11?

(WinCE admitedly is another issue completely, as it has not keyboard usually).

Mirek
Re: GetNumLock and GetScrollLock functions [FEATURE REQUEST] [message #14782 is a reply to message #14776] Fri, 14 March 2008 16:23 Go to previous messageGo to next message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Quite frankly, I was kind of hoping someone already knew how to make it happen in X11 and would generously donate that knowledge to the Upp code base. If it is simply impossible, I will have to reconsider if I should anymore use key bindings to Scroll Lock at all.

// Tom
Re: GetNumLock and GetScrollLock functions [FEATURE REQUEST] [message #14805 is a reply to message #14782] Sat, 15 March 2008 15:12 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Tom1 wrote on Fri, 14 March 2008 11:23

Quite frankly, I was kind of hoping someone already knew how to make it happen in X11 and would generously donate that knowledge to the Upp code base. If it is simply impossible, I will have to reconsider if I should anymore use key bindings to Scroll Lock at all.

// Tom


I guess there is nothing wrong using them as long as you are doing Win32 application.

Anyway, the whole point of all these functions is to make it portable. Calling "(GetKeyState(VK_CAPITAL) & 1)" in Win32 app does look like a big deal to me Wink

Mirek
Previous Topic: Using U++ without TheIDE
Next Topic: SetCurrentDirectory()
Goto Forum:
  


Current Time: Fri Mar 29 05:51:22 CET 2024

Total time taken to generate the page: 0.02318 seconds