Page 1 of 1

LISTBROWSER_HintInfoHook problem [SOLVED]

Posted: Tue Jun 05, 2012 7:09 pm
by OldFart
Hi,

When I was exploring the use of this tag I found it not working as expected.

The listbrowser has an initial text for GA_HintInfo.
A hook structure was allocated properly, with ASOHOOK_Entry pointing to the function, who's contents bears down to this:

Code: Select all

void Create_HintInfo(struct Hook *hk, Object *o, struct Node *n)
{
  IIntuition->SetAttrs(o, GA_HintInfo, "Some text", TAG_END);
}
All I get is a small rectangle with NO text inside when I hover the mousepointer over a node.

Am I doing something wrong?

P.s.: SetAttrs gives a non-zero return value, indicating a refresh would be in place, which surprises me as the listbrowser itself nor any node has undergone any visual change.

OldFart

Re: LISTBROWSER_HintInfoHook problem

Posted: Tue Jun 05, 2012 7:15 pm
by Rigo
That is because you are not using it correctly. The hook function should return a pointer to the text to use, not set the actual attribute.

See the listbrowser autodoc for further info, specifically this;

LISTBROWSER_HintInfoHook (struct Hook *)
When the gadgets GM_QUERY method is invoked, the hook passed by
this tag will be called. This allows the listbrowser to dynamically
change the hintinfo string shown by this gadget. As there is no way
for the gadget itself to determine what the string should be, the
usercode hook can set it accordingly. The hook will have the following
parameters initialised:

HintInfoHook( struct Hook *hook, Object *o, struct Node *lbn )

The first two parameters are standard hook function parameters,
but the third is a pointer to the listbrowser node that the mouse
pointer is currently over when the hook is called. You can use
GetListBrowserNodeAttrs() on this pointer to determine what the
hintinfo string should be set to. Once a string is decided on,
simply return the pointer as a LONG. The node pointer is
guaranteed to be valid when the hook is called, but not once the
hook has returned, so do not reference it after the hook has
returned.

Applicability is (OM_NEW, OM_SET)

Simon

Re: LISTBROWSER_HintInfoHook problem

Posted: Tue Jun 05, 2012 10:23 pm
by OldFart
@Rigo

Thank you! Thing is working now.

OldFart