Solved: Gadget class and help bubble how to do ?
- TSK
- Beta Tester
- Posts: 225
- Joined: Mon Dec 20, 2010 1:15 pm
- Location: Home land of Santa C., sauna, sisu and salmiakki
Solved: Gadget class and help bubble how to do ?
I'm developing a gadget class. How do I add HintInfo/Help bubble support into it ? Amiga Wiki tells when receiving GM_HELPTEST message then I should return GMR_HELPHIT as a return value. Or should I open a window myself and draw the help text into it or should Intuition do it for me ?
Last edited by TSK on Tue Jun 07, 2016 2:15 am, edited 1 time in total.
Keep the party going !
- broadblues
- AmigaOS Core Developer
- Posts: 600
- Joined: Sat Jun 18, 2011 2:40 am
- Location: Portsmouth, UK
- Contact:
Re: Gadget class and help bubble how to do ?
In the simplest case you don't, just pass GM_HELPTEST on to the superclass and let gadget class handle it for you.TSK wrote:I'm developing a gadget class. How do I add HintInfo/Help bubble support into it
Yes, if your gadget is a funny shape then that's what you should do. Test for a hit and return the result accordingly.? Amiga Wiki tells when receiving GM_HELPTEST message then I should return GMR_HELPHIT as a return value.
No never do that.Or should I open a window myself and draw the help text into it or should Intuition do it for me ?
You also need to respond to a GM_QUERY see the comments in gadgetclass.h and this emables you to pass back the text you want displayed. Normally the text that was set with GA_HintInfo. But if you have a more complex gadget it might depend on which area the mouse is over.
This all applies to version 53 and up, I'm less ure how to go about it older versions.
- TSK
- Beta Tester
- Posts: 225
- Joined: Mon Dec 20, 2010 1:15 pm
- Location: Home land of Santa C., sauna, sisu and salmiakki
Re: Gadget class and help bubble how to do ?
Code: Select all
case GM_HELPTEST:
id=INST_DATA(cl,o);
ret=IIntuition->IDoSuperMethodA(cl,o,msg);
ret=GMR_HELPHIT;
break;
case GM_QUERY:
id=INST_DATA(cl,o);
if (((struct gpQuery *)msg)->gpq_Type==GMQ_HINTINFO)
{
((struct gpQuery *)msg)->gpq_Data=(int32 *)id->HintInfo;
}
ret=IIntuition->IDoSuperMethodA(cl,o,msg);
ret=GMR_NOREUSE;
break;
Keep the party going !
- broadblues
- AmigaOS Core Developer
- Posts: 600
- Joined: Sat Jun 18, 2011 2:40 am
- Location: Portsmouth, UK
- Contact:
Re: Gadget class and help bubble how to do ?
You appear to be both handling it yourself, *and* sending it to the superclass.
Do one or the other.
In this case, at quick glance, you own code looks okay, so remove the supermethod calls.
Do one or the other.
In this case, at quick glance, you own code looks okay, so remove the supermethod calls.
- TSK
- Beta Tester
- Posts: 225
- Joined: Mon Dec 20, 2010 1:15 pm
- Location: Home land of Santa C., sauna, sisu and salmiakki
Re: Gadget class and help bubble how to do ?
In GM_QUERY, who ever calls the dispatcher function, returns instance data of the first gadget in a layout/window no matter which one of the many gadgets mouse is over. How do I tell GM_QUERY which gadget it is ? I don't get anything displayed no matter if I'll remove those SuperMethod calls or use them and remove the rest. But if I hover mouse on another type of gadget like a checkbox at first then system will display the text of that gadget on any of my gadgets.
I'll have to give up I don't want to put more time into this. Anybody with a completed and completely working example ?
Programming for AmigaOS in general is too low level and complicated. If you make one tiny little wrong detail somewhere it takes the whole Intuition down usually. I'm completely fed up with that.
I'll have to give up I don't want to put more time into this. Anybody with a completed and completely working example ?
Programming for AmigaOS in general is too low level and complicated. If you make one tiny little wrong detail somewhere it takes the whole Intuition down usually. I'm completely fed up with that.
Keep the party going !
- broadblues
- AmigaOS Core Developer
- Posts: 600
- Joined: Sat Jun 18, 2011 2:40 am
- Location: Portsmouth, UK
- Contact:
Re: Gadget class and help bubble how to do ?
Not sure about, I suspect in layout based window that the layout.gadget gets the GM_QUERY then passes it on to it's chldren.TSK wrote:In GM_QUERY, who ever calls the dispatcher function, returns instance data of the first gadget in a layout/window no matter which one of the many gadgets mouse is over.
The caller already knows which gadget you are.How do I tell GM_QUERY which gadget it is ?
That's because:I don't get anything displayed no matter if I'll remove those SuperMethod calls or use them and remove the rest. But if I hover mouse on another type of gadget like a checkbox at first then system will display the text of that gadget on any of my gadgets.
Is good, but it's not quite right...((struct gpQuery *)msg)->gpq_Data=(int32 *)id->HintInfo;
The pointer in gpQuery is apointer to the place the data needs to be written too. That's why it;s the rather odd LONG * instead of APTR which it would be if it were a pointer abritrary data.*(((struct gpQuery *)msg)->gpq_Data) = (LONG )"This is my hint";
Remove the super class calls and make that chnage and I think you'll have it.I'll have to give up I don't want to put more time into this. Anybody with a completed and completely working example ?
Programming gadgets is as low level as you can get, in user interface terms at least, you must be doing fairly well if you got to the point of worrying about HintInfo etcProgramming for AmigaOS in general is too low level and complicated. If you make one tiny little wrong detail somewhere it takes the whole Intuition down usually. I'm completely fed up with that.
- TSK
- Beta Tester
- Posts: 225
- Joined: Mon Dec 20, 2010 1:15 pm
- Location: Home land of Santa C., sauna, sisu and salmiakki
Re: Gadget class and help bubble how to do ?
Now I get the help bubbles. But Query is made to the first gadget still no matter which gadget mouse is over.
Being experienced coder of several decades I thought I understand C pointers well nowadays. But it seems, it is still not clear always. Sometimes you have to provide a pointer, sometimes system reserves space where you copy/attach the content to, and so on... That's why good examples and clear consistent autodocs are always worth their weight in gold.
Being experienced coder of several decades I thought I understand C pointers well nowadays. But it seems, it is still not clear always. Sometimes you have to provide a pointer, sometimes system reserves space where you copy/attach the content to, and so on... That's why good examples and clear consistent autodocs are always worth their weight in gold.
Thanks for encouragement.you must be doing fairly well if you got to the point of worrying about HintInfo etc
Keep the party going !
- TSK
- Beta Tester
- Posts: 225
- Joined: Mon Dec 20, 2010 1:15 pm
- Location: Home land of Santa C., sauna, sisu and salmiakki
Solved: Re: Gadget class and help bubble how to do ?
I got help from another coder so this works ok now.
Keep the party going !