Getting muikey events in Area-classes
  • Moderator
    Kronos
    Posts: 2362 from 2003/2/24
    O.k. not sure if this is a bug or just me being me.....

    1st look at demo/class3.c
    Does exactly what I want, but relies on the obsolete MUI_RequestIDCMP()

    So I thought I'll just add it into the MUIM_HandleEvent of my class.

    Setup:
    Code:

    data->ehn.ehn_Object = obj;
    data->ehn.ehn_Class = 0;//cl;
    data->ehn.ehn_Events = /*IDCMP_MOUSEBUTTONS | IDCMP_INTUITICKS | IDCMP_MOUSEMOVE |*/ IDCMP_RAWKEY;// |*/ IDCMP_VANILLAKEY;
    DoMethod(_win(obj),MUIM_Window_AddEventHandler,&data->ehn);


    As you may see I tried setting it directly to my class or leaving it blank, RAW or VANILLA key...
    MUIM_HandleEvent :
    Code:
    static ULONG mHandleEvent(struct IClass *cl,Object *obj,struct MUIP_HandleEvent *msg)
    {
    struct Data *data = (struct Data*)INST_DATA(cl,obj);
    struct TagItem tretval;

    {
    PDB(("rk %xn",msg->muikey));
    if (msg->muikey!=MUIKEY_NONE)
    {
    PDB(("mkn"));
    switch (msg->muikey)
    {
    case MUIKEY_LEFT :
    case MUIKEY_RIGHT:
    case MUIKEY_UP :
    case MUIKEY_DOWN :
    case MUIKEY_CUT:
    PDB(("n"));
    break;
    }
    }
    }

    Whatever key(s) I press, I never get the "mk\n" nor the "\n".

    Did a quick test with another object based on MUIC_String and get the same results as long as the string is empty. As soon as it has a contents I get propper muikey-codes.
  • »30.05.14 - 12:55
    Profile
  • Moderator
    Kronos
    Posts: 2362 from 2003/2/24
    O.k. after some hints from tokai:

    Object need to be either MUIA_Window_ActiveObject or MUIA_Window_DefaultObject in it's parent window to get muikeys.
  • »30.05.14 - 15:44
    Profile