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++ Widgets - General questions or Mixed problems » Overriding Key method disable tab browsing
Overriding Key method disable tab browsing [message #53724] Fri, 24 April 2020 18:03 Go to next message
Giorgio is currently offline  Giorgio
Messages: 218
Registered: August 2015
Experienced Member
Hi there,
I had been using RegisterSystemHotKey to allow users to perform some actions in my application. The shortcoming of this approach is that the registration is system wide, so other application cannot use the registered key. Users have been complaining for that for a while, so I investigated the issue and found that overriding the Key method would permit to restrict the usage to a specific window. Below is my code.

bool Key(dword keys, int count){
  if(keys==K_F10){
    HandleF10();
    return true;
  }
  return false;
}


The problem with this solution is that the user cannot move between fields using the tab key.

Is there a way to fix that?
Thanks,
gio
Re: Overriding Key method disable tab browsing [message #53756 is a reply to message #53724] Tue, 28 April 2020 09:59 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Now I am not 100% sure what Key method is this, but I believe that you need to:

bool Key(dword keys, int count){
  if(keys==K_F10){
    HandleF10();
    return true;
  }
  return TopWindow::Key(keys, count); // <== TopWindow::Key handles Tab
}
Re: Overriding Key method disable tab browsing [message #53759 is a reply to message #53756] Tue, 28 April 2020 10:23 Go to previous messageGo to next message
Giorgio is currently offline  Giorgio
Messages: 218
Registered: August 2015
Experienced Member
Hi Mirek,
the method is in the header of the window class (that is a TopWindow) so - if I understand correctly your question - is the Key method of the window, and of course your code works Smile

I'm wondering if it could be possible to override the Key method of a Ctrl without creating a derived class (I find very convenient to set some Ctrl's properties in the lay editor and AFAIK a new derived class would lose this feature).

Regards,
gio
Re: Overriding Key method disable tab browsing [message #53762 is a reply to message #53759] Tue, 28 April 2020 10:42 Go to previous message
mirek is currently offline  mirek
Messages: 13984
Registered: November 2005
Ultimate Member
Ctrl::InstallKeyHook
Previous Topic: [Proposal] EditSecret dialogs (EditText variants), for password, etc input..
Next Topic: Dynamic Ctrl frame
Goto Forum:
  


Current Time: Sun Jun 16 07:30:09 CEST 2024

Total time taken to generate the page: 0.02320 seconds