Welcome, Guest. Please login or register.

Author Topic: Help needed with MUI Hooks - MOS - 68K  (Read 2310 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline mastergeppTopic starter

  • Newbie
  • *
  • Join Date: Aug 2006
  • Posts: 7
    • Show only replies by mastergepp
Help needed with MUI Hooks - MOS - 68K
« on: August 26, 2006, 12:32:32 AM »
Ok, the ftp app i mentitioned in the other thread (MUI jump blah) is going on pretty nicely (on aros at least).

I had it almost working on every amigaos (except os4 which i lack the hw), i added an hook on a mui attribute change and can't seem able to figure out how to do it on Morphos, 68k version would be nice too:

DoMethod(stringblah, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime, app, 2, MUIM_CallHook, &KeyPressHook);

How do i define KeyPressHook on Morphos, and possibily, on OS 3.x?

oh, maybe you can be so nice and tell me which includes i need  for each os ?
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Help needed with MUI Hooks - MOS - 68K
« Reply #1 on: August 26, 2006, 01:06:43 AM »
Generic solution (not just MUI), works for MorphOS and AmigaOS 3.x (at least):
Code: [Select]

#include <utility/hooks.h>
#include <clib/alib_protos.h>

ULONG hook_func(struct Hook *MyHook,
                Object *MyObject,
                APTR MyMsg);

struct Hook hook =
{
        {NULL, NULL},          /* h_MinNode */
        (HOOKFUNC) HookEntry,  /* h_Entry */
        (HOOKFUNC) hook_func,  /* h_SubEntry */
        NULL                   /* h_Data */
};

ULONG hook_func(struct Hook *MyHook,
                Object *MyObject,
                APTR MyMsg)
{
        /* MyHook->h_Data can be used to pass userdata */
        /* MyMsg is whatever the specific hook makes it to be */

        /* ... */

        return 0;
}


HookEntry is in amiga.lib (or libamiga.a/libabox.a). For SAS/C you should lib with amiga.lib and gcc with -lamiga (m68k) or -labox (morphos).
 

Offline mastergeppTopic starter

  • Newbie
  • *
  • Join Date: Aug 2006
  • Posts: 7
    • Show only replies by mastergepp
Re: Help needed with MUI Hooks - MOS - 68K
« Reply #2 on: August 26, 2006, 02:13:58 PM »
Thanks piru, tried only on mos for now and works fine.
 

Offline r-tea

  • Newbie
  • *
  • Join Date: Feb 2005
  • Posts: 26
    • Show only replies by r-tea
    • http://www.ppa.pl/paubase/showuser.php?id=136
Re: Help needed with MUI Hooks - MOS - 68K
« Reply #3 on: August 29, 2006, 06:31:00 AM »
A new ATC is coming on? Nice...  :-)
/* Amiga Pegasos II PPC 750CXe @ 600 */