LISTBROWSER_HintInfoHook problem [SOLVED]

This forum is for general developer support questions.
Post Reply
User avatar
OldFart
Posts: 66
Joined: Tue Jul 12, 2011 2:56 pm
Location: Groningen, Netherlands

LISTBROWSER_HintInfoHook problem [SOLVED]

Post 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
Last edited by OldFart on Tue Jun 05, 2012 9:24 pm, edited 1 time in total.
X5000, put back into storage since May 16, 2021 and eagerly awaiting awakening or so I hope
Dead MicroA1
A1200 in ElBox, c/w Blizzard '040 @ 50MHz + SCSI module, ZIV-board c/w (o.a.) cv64/3d + flickerdoubler + FastATA-ZIV + Lots of SCSI gear.
RaspBerry Pi 2B, 3B, 4B (4Gb) & 4B (8Gb) attached to Aten QubiC 4-port KVM
User avatar
Rigo
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 354
Joined: Mon Jan 17, 2011 9:42 pm

Re: LISTBROWSER_HintInfoHook problem

Post 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
User avatar
OldFart
Posts: 66
Joined: Tue Jul 12, 2011 2:56 pm
Location: Groningen, Netherlands

Re: LISTBROWSER_HintInfoHook problem

Post by OldFart »

@Rigo

Thank you! Thing is working now.

OldFart
X5000, put back into storage since May 16, 2021 and eagerly awaiting awakening or so I hope
Dead MicroA1
A1200 in ElBox, c/w Blizzard '040 @ 50MHz + SCSI module, ZIV-board c/w (o.a.) cv64/3d + flickerdoubler + FastATA-ZIV + Lots of SCSI gear.
RaspBerry Pi 2B, 3B, 4B (4Gb) & 4B (8Gb) attached to Aten QubiC 4-port KVM
Post Reply