RhinoApp.KeyboardEvent MacOS problem

Hi,
i have implemented Hotkeys for one of my commands and it works nice in Windows.
However on MacOS the command crashes Rhino completely when stepping over

RhinoApp.KeyboardEvent += OnRhinoKeyboardEvent;

I can find no clues in debugging on why this is happening. It just crushes Rhino.

Thanks in advance!

Hotkeys and method:

// Hotkeys

    private const int VK_W = 0x0D;
    private const int VK_S = 0x01;
    private const int VK_A = 0x00;
    private const int VK_D = 0x02;

    private bool w_key_pressed = false;
    private bool s_key_pressed = false;
    private bool a_key_pressed = false;
    private bool d_key_pressed = false;

    void OnRhinoKeyboardEvent(int key)
    {
        if (key == VK_W)
        {
            w_key_pressed = true;
            diamStone = diamStone + 0.05;
        }
        else if (key == VK_S)
        {
            s_key_pressed = true;
            diamStone = diamStone - 0.05;
        }
        else if (key == VK_A)
        {
            a_key_pressed = true;
            offSetStone = offSetStone - 0.025;
        }
        else if (key == VK_D)
        {
            d_key_pressed = true;
            offSetStone = offSetStone + 0.025;
        }
    }

For testing, comlete code in download link…

FJ_PaveSetCommand.cs (10.5 KB)

1 Like

Hi @dan ,
sorry to bother you directly… you seem to be active on the MacOS side of Rhino.
Sadly i had no responses to my post… Maybe you can help me or stir me in the right direction?
Thanks in advance!

Hey sorry, I was away for a couple of days. I’m playing catch up here…so let me see if I can reproduce this soon.

Thanks for the code sample. Yes, I’m able to reproduce it here on my end. Looks like something that has been left unimplemented. I’m seeing a MacFail here in our code. I’ll dig deeper.

Again, I apologize for the delay on this. Yes, this is an unimplemented function on our side. I logged this here:

RH-63904 RHC_SetKeyboardCallback unimplemented on Mac (MACFAIL)

I’m not sure what a viable workaround would be at the moment. Perhaps @stevebaer has ideas.

1 Like

We never implemented it on Mac as no one has ever needed it. Dan got this on my list to fix, but I have no idea when I will be able to implement this.

I would recommend not registering for this event on Mac for the time being.

I would love to have this implemented :slight_smile:
But i also understand that there might be more pressing issues with Rhino4 Mac at the moment…
Thanks for letting me know.

Hi @stevebaer ,
any idea when rhino4mac can expect hotkeys jet?
Best
S

Sorry, I don’t have a date that I can give you.