[ADDED] Checking panel hot key improvement

36 posts
Re: Checking panel hot key improvement

elliswr
MMEX Developer

Posts: 151
Joined: Tue May 05, 2009 2:21 am
Location: Granbury, TX
So, I know this is not the code of the latest fix that you submitted, but I was having issues merging yours and Vadim's latest patches. At any rate, I got to thinking about why 'd' or 'D' worked as well as Delete for marking transactions and nothing else did. Have a look at this code:
Code: Select all
void MyListCtrl::OnChar(wxKeyEvent& event)
{
    switch ( event.GetKeyCode() )
    {
        case 'v':
        case 'V':
        case 'r':
        case 'R':
        case 'u':
        case 'U':
        case 'f':
        case 'F':
            // these are the keys we process ourselves
            break;

        default:
            event.Skip();
    }


Notice that it does not contain 'd', 'D", or Delete. So just for a go, I decidded to comment out the F's like so:
Code: Select all
void MyListCtrl::OnChar(wxKeyEvent& event)
{
    switch ( event.GetKeyCode() )
    {
        case 'v':
        case 'V':
        case 'r':
        case 'R':
        case 'u':
        case 'U':
        //case 'f':
        //case 'F':
            // these are the keys we process ourselves
            break;

        default:
            event.Skip();
    }


After building with these changes, the F, f, d, D, and Delete all work on the mac. So, I would have to say somewhere here in lies our problem.
Re: Checking panel hot key improvement

elliswr
MMEX Developer

Posts: 151
Joined: Tue May 05, 2009 2:21 am
Location: Granbury, TX
Taking a look at the event table, I find the event that calls MyListCtrl::OnChar to be EVT_CHAR. I took a look at the wxWidgets Documentation and there is no such mention of this for a wxListCtrl. While this may be inherited, what is the point of even using this? If we just use EVT_LIST_KEY_DOWN to call OnListKeyDown and handle all of our keys there, this should work.


I've just tried it out before posting getting rid of EVT_CHAR(MyListCtrl::OnChar) all together and it works perfectly. Also, other keys pressed do not do anything, as expected.

Nikolay, could you try just getting rid of that and seeing if it works the same on Windows?
Re: Checking panel hot key improvement

elliswr
MMEX Developer

Posts: 151
Joined: Tue May 05, 2009 2:21 am
Location: Granbury, TX
Even without this:
Code: Select all
if (!wxGetKeyState(WXK_ALT) && !wxGetKeyState(WXK_CONTROL))
All the hotkeys work as expected (not active while Control, Alt, or Command are pressed) on the mac. Not sure about windows, but the return key does't act the same, nor do arrows, so I would assume that all the others you have listed are the same.

I think if we just discriminated within OnListKeyDown, that would be the easiest fix with the least code production.

Cheers,
Wes
Re: Checking panel hot key improvement (MS Windows)

Nikolay
MMEX Developer

Posts: 2284
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia
Hi,

I have checked how the hot keys work on Ubuntu (without my patch). All the hotkeys work as expected. With the participation of the keyboard Atl, Ctrl too well.

Conclusion: This patch is required only for Windows.
Re: Checking panel hot key improvement (MS Windows)

Nikolay
MMEX Developer

Posts: 2284
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia
Hi Wes,

Could you kindly check my last creation?
Attachments
cp_hotkeys.zip
(709 Bytes) Downloaded 260 times
Re: Checking panel hot key improvement (MS Windows)

elliswr
MMEX Developer

Posts: 151
Joined: Tue May 05, 2009 2:21 am
Location: Granbury, TX
Nik,
The patch fails against the current trunk version. Could you attach the mmcheckingpanel.cpp file?
Re: Checking panel hot key improvement (MS Windows)

Nikolay
MMEX Developer

Posts: 2284
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia
Attachments
mmcheckingpanel.zip
(9.01 KiB) Downloaded 245 times
Re: Checking panel hot key improvement (MS Windows)

elliswr
MMEX Developer

Posts: 151
Joined: Tue May 05, 2009 2:21 am
Location: Granbury, TX
Nik,
That still doesn't work on Mac because EVT_CHAR is not a member of the wxlistctrl class.

Try this out, it works mo betta on Mac:
Attachments
mmcheingpanel.zip
Good Stuff
(12.53 KiB) Downloaded 257 times
Re: Checking panel hot key improvement (MS Windows)

Nikolay
MMEX Developer

Posts: 2284
Joined: Sat Dec 06, 2008 8:27 am
Location: Sankt-Petersburg, Russia
Hi Wes,

I have tried to do something similar, according to your recommendation. This works but badly.
For example, when you press the keys alt + V, entry is marked as Void and drops the "View" menu at the same time and the cursor escapes on the very first posting.
Re: Checking panel hot key improvement (MS Windows)

elliswr
MMEX Developer

Posts: 151
Joined: Tue May 05, 2009 2:21 am
Location: Granbury, TX
Hi Nik.

I didn't even notice it, but I forget to add WXK_ALT in the code I added:

Code: Select all
if (!wxGetKeyState(WXK_LEFT) && !wxGetKeyState(WXK_RIGHT) && !wxGetKeyState(WXK_UP) && !wxGetKeyState(WXK_DOWN)
       && !wxGetKeyState(WXK_NUMPAD_LEFT) && !wxGetKeyState(WXK_NUMPAD_RIGHT) && !wxGetKeyState(WXK_NUMPAD_UP) && !wxGetKeyState(WXK_NUMPAD_DOWN)
       && !wxGetKeyState(WXK_PAGEDOWN) && !wxGetKeyState(WXK_END) && !wxGetKeyState(WXK_NUMPAD_PAGEUP) && !wxGetKeyState(WXK_NUMPAD_PAGEDOWN)
       && !wxGetKeyState(WXK_HOME) && !wxGetKeyState(WXK_PAGEUP) && !wxGetKeyState(WXK_NUMPAD_HOME) && !wxGetKeyState(WXK_NUMPAD_END)
       && !wxGetKeyState(WXK_TAB) && !wxGetKeyState(WXK_BACK) && !wxGetKeyState(WXK_NUMPAD_DELETE) && !wxGetKeyState(WXK_MENU)
      && !wxGetKeyState(WXK_COMMAND))


So, if you add
Code: Select all
&& !wxGetKeyState(WXK_ALT)
to the end of that list, it should work. Please try it out and let me know. On Mac, alt isn't used for menu navigation and I forgot about that, sorry.
Who is online

Users browsing this forum: No registered users and 10 guests

cron