On latest revision 94812c9e06c, wxGetKeyState(WXK_CAPITAL) is always false, even with CAPS LOCK on. Same for WXK_NUMLOCK. Last known good commit is c3856766107b.
I use it to show CAPS and NUM lock state in a status bar.
Should it be reported as a bug ?
Thank you.
wxGetKeyState always returns false
Re: wxGetKeyState always returns false
I am not on the latest commit but I am certainly not on a commit from 2020 yet it works for me as expected
So I it would seem that wxGetKeyState() itself is not an issue.
I am on Windows (10) but I assume so are you.
Code: Select all
#include <wx/wx.h>
class MyApp : public wxApp
{
public:
bool OnInit() override
{
wxDialog dlg(nullptr, wxID_ANY, "Test");
wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
mainSizer->Add(new wxButton(&dlg, wxID_ANY, "Report Caps Lock State"), wxSizerFlags().Expand().TripleBorder());
dlg.Bind(wxEVT_BUTTON, [](wxCommandEvent&) { wxLogMessage("Caps Lock %s, NumLock %s",
wxGetKeyState(WXK_CAPITAL) ? "ON" : "OFF", wxGetKeyState(WXK_NUMLOCK) ? "ON" : "OFF"); });
dlg.SetSizerAndFit(mainSizer);
dlg.ShowModal();
return false;
}
}; wxIMPLEMENT_APP(MyApp);
I am on Windows (10) but I assume so are you.
Re: wxGetKeyState always returns false
Just tested your code, NUM and CAPS lock both report false, always, on Arch Linux with latest commit (GTK3 build).
Re: wxGetKeyState always returns false
When you did not report the platform I assumed the dominant one, i.e., MS Windows. Anyway, I tried with wxWidgets 3.1.4 (GTK3), which are newer than the "last good commit" you referenced, on Ubuntu 20.04 and it still works.
I found out that the statbar sample also displays the Caps and Num locks state (I had to use menu command Status Bar / Recreate there, make the frame larger yet the indicators were still ellipsized). Can you reproduce it there? If so, I would file a report on wxTrac.
I found out that the statbar sample also displays the Caps and Num locks state (I had to use menu command Status Bar / Recreate there, make the frame larger yet the indicators were still ellipsized). Can you reproduce it there? If so, I would file a report on wxTrac.
Re: wxGetKeyState always returns false
It's always OFF in the statbar sample. I'll report it tomorrow.
Thanks for your input.
Thanks for your input.
Re: wxGetKeyState always returns false
I would just make sure the last good commit is correct. It seems that the next commit is
https://github.com/wxWidgets/wxWidgets/ ... 700915023b
which does not change any code.
https://github.com/wxWidgets/wxWidgets/ ... 700915023b
which does not change any code.
Re: wxGetKeyState always returns false
Reported on trac [url]https://trac.wxwidgets.org/ticket/19083[/url], with a significant bisection result.