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
SpeedBar Button input doc
Re: SpeedBar Button input doc
@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.
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.
The Rear Window blog
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
Re: SpeedBar Button input doc
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.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.
The AutoDocs don't make that clear though.
Tom
Re: SpeedBar Button input doc
@tbreeden
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.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.
The Rear Window blog
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition
AmigaOne X5000 @ 2GHz / 4GB RAM / Radeon RX 560 / ESI Juli@ / AmigaOS 4.1 Final Edition
SAM440ep-flex @ 667MHz / 1GB RAM / Radeon 9250 / AmigaOS 4.1 Final Edition