SpeedBar Button input doc

Have a question about our Software Developer Kit? Ask them here.

SpeedBar Button input doc

Postby tbreeden » Sat Dec 01, 2012 8:31 pm

There seems to be some confusion about how to get the speedbar input.

I see that the SDK Reaction example for speedbar reads the code to get the
button that generated a WMHI_GADGETUP on the speedbar obtained by
a call to handle input method.

This is not mentioned in the AutoDocs for speedbar_cl (53.20), but experiment
shows that it does contain the id assigned to the "button" in the call to
AllocSpeedButtonNode() - not just the index from 0 in the speedbar.

Probably already taken care of in the to-be-released SDK, but otherwise it
should be documented or forbidden.

Tom
User avatar
tbreeden
 
Posts: 92
Joined: Sat Jun 18, 2011 1:57 am
Location: Charlottesville, VA, USA

Re: SpeedBar Button input doc

Postby trixie » Fri Dec 14, 2012 12:52 pm

@tbreeden

To handle speedbar.gadget input, I enum a set of button IDs and put them in SBNA_UserData when I AllocSpeedButtonNode() the respective button's node. When I receive an IDCMP_GADGETUP from the speedbar, I switch() the code and compare against the IDs. Always worked, been using this for years.
Smoke me a kipper, I'll be back for breakfast!
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
trixie
 
Posts: 357
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic

Re: SpeedBar Button input doc

Postby tbreeden » Tue Dec 18, 2012 3:59 am

trixie wrote:To handle speedbar.gadget input, I enum a set of button IDs and put them in SBNA_UserData when I AllocSpeedButtonNode() the respective button's node. When I receive an IDCMP_GADGETUP from the speedbar, I switch() the code and compare against the IDs. Always worked, been using this for years.


Yes, that definitely will work, but it does not appear that it is necessary to put the IDs into SBNA_UserData. Since the ID is a parameter to AllocSpeedButtonNode(), it must be stored somewhere in the node, because it will be in the code after a GadgetUp without you having to put it anywhere. SBNA_UserData could probably be used for something else if you needed it.

The AutoDocs don't make that clear though.

Tom
User avatar
tbreeden
 
Posts: 92
Joined: Sat Jun 18, 2011 1:57 am
Location: Charlottesville, VA, USA

Re: SpeedBar Button input doc

Postby trixie » Tue Dec 18, 2012 10:13 am

@tbreeden
tbreeden wrote:it does not appear that it is necessary to put the IDs into SBNA_UserData. Since the ID is a parameter to AllocSpeedButtonNode(), it must be stored somewhere in the node, because it will be in the code after a GadgetUp without you having to put it anywhere. SBNA_UserData could probably be used for something else if you needed it.

The AutoDocs don't make that clear though.


You are right - currently, the button ID is stored in the particular node's priority field (which is a clear hack and misuse of the node datastructure). The speedbar autodoc mentions this fact, and also adds that this may change in the future. This is probably why some of the available ReAction examples also store the ID in the userdata field. It is more future-proof to retrieve the ID from the userdata field than from the node's priority field.
Smoke me a kipper, I'll be back for breakfast!
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
User avatar
trixie
 
Posts: 357
Joined: Thu Jun 30, 2011 3:54 pm
Location: Czech Republic


Return to SDK Support

Who is online

Users browsing this forum: No registered users and 1 guest