Amiga.org
Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: mastergepp 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 ?
-
Generic solution (not just MUI), works for MorphOS and AmigaOS 3.x (at least):
#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).
-
Thanks piru, tried only on mos for now and works fine.
-
A new ATC is coming on? Nice... :-)