@ZeroG
This was very helpfull, thanks
I do understand the Backfiil hook now that does not work yet,
I do not fully understand the GTST Edithook, but it worked, i just wantrd to compare both.
>A)
>The gadtools autodocs says that GTST_EditHook will be copied to the StringExtend->EditHook >field.
I read this which is far less clear
"==========================================
GTST_EditHook (struct Hook *) - Hook to use as a custom string gadget
edit hook (StringExtend->EditHook) for this gadget. GadTools will
allocate the StringExtend->WorkBuffer for you. (defaults to NULL)
"==========================================
>If you now make a quick search in the includes you will find the file intuition/sghooks.h. Have >you read it?
I find the stuff below, however this does not tell me how my hookfunction gets its SGW argument. ??
"===================================
struct StringExtend
{
/* display specifications */
struct TextFont *Font; /* must be an open Font (not TextAttr) */
UBYTE Pens[2]; /* color of text/backgroun */
UBYTE ActivePens[2]; /* colors when gadget is active */
/* edit specifications */
ULONG InitialModes; /* initial mode flags, below */
struct Hook *EditHook; /* if non-NULL, must supply WorkBuffer */
STRPTR WorkBuffer; /* must be as large as StringInfo.Buffer*/
ULONG Reserved[4]; /* set to 0 */
};
struct SGWork
{
/* set up when gadget is first activated */
struct Gadget *Gadget; /* the contestant itself */
struct StringInfo *StringInfo; /* easy access to sinfo */
STRPTR WorkBuffer; /* intuition's planned result */
STRPTR PrevBuffer; /* what was there before */
ULONG Modes; /* current mode */
/* modified for each input event */
struct InputEvent *IEvent; /* actual event: do not change */
UWORD Code; /* character code, if one byte */
WORD BufferPos; /* cursor position */
WORD NumChars;
ULONG Actions; /* what Intuition will do */
LONG LongInt; /* temp storage for longint */
struct GadgetInfo *GadgetInfo; /* see cghooks.h */
UWORD EditOp; /* from constants below */
};
========================================
B)
>A WA_BackFill hook is, as the autodoc says, a LayerHook that is described in Layers.doc
>InstallLayerHook() as
>void LayerHookFunc(struct Hook *, struct RastPort *, struct BackFillMessage *);
>BTW: The InstallLayerHook() autodocs needs a update, it still has a 68k-asm example.
I found this
======================
/*
* The message a backfill hook receives
*/
struct BackFillMessage
{
struct Layer *Layer;
struct Rectangle Bounds;
LONG OffsetX;
LONG OffsetY;
};
=======================
In the source however i found
struct BackFillData
{
struct Layer *l;
struct Rectangle bounds;
LONG offx, offy;
};
which closely matches BackFillMessage
and the hookfunction referring to the latter
ULONG INTERRUPT SAVEDS do_backfill(struct Hook *h, struct RastPort *rp, struct BackFillData *bfd)
This was the source of my bewildering: i did not find this structure BackFillData in th includes, and i did not see where it was initialised.
Joseph