Hi,
In ReAction GUI, is it possible to create a hidden button that can be made visible when needed?
What I'd like to do is to show an image button (busy indicator) when my program is processing data and then hide the button when the program has finished processing the data.
According to autodocs, gadgetclass has a boolean attribute GA_Hidden for hiding gadgets. However, that attribute doesn't seem to work for a button.gadget.
Hi, you can try with GA_Disabled,TRUE/FALSE and see if it suits your needs.
Or just create the button object and use LM_ADDCHILD/LM_REMOVECHILD to show/hide button.
That is what I use in (sources included) http://www.os4depot.net/share/utility/docky/keymapswitcher_docky.lha
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
You might also try the GA_Hidden tag, although I've never used it, or whether it even works for ReAction gadgets...
Simon
The GA_Hidden tag exists solely for use by page.gadget to tell if gadgets are on a page that is currently not visible and is not usable as a general mechanism for hiding objects in a layout.
It should however be possible to add/remove a gadget using the LM_ADDCHILD/LM_REMOVECHILD methods (make sure to also invoke the WM_RETHINK method on the window object afterwards). When removing use the CHILD_NoDispose tag (set to TRUE) if you don't want the gadget to be disposed.
The GA_Hidden tag made the button non-functional but it didn't hide it.
After various experiments I decided to hide the image button by changing its image to a transparent one. An info text should appear in place of the button when it's invisible. I thought I'd need to hide/remove the button and put a label in its place, but then I realised that I just needed to use a transparent image and set the button's text.
The only downside is that I can't display multiple text lines on the button.
IIRC you can create an "image" of text using label.image class and the add it to the button as an image.
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
@jap
But clicking on the (now invisible) button area will still generate Intuition input, right? That's not what you want.
In my GUIs, when I need to hide an element I usually use a page.gadget. The "dynamic" area of my window layout is represented by a page.gadget object with two alternating pages: one with all elements, and the other with the given element missing. When it's time to "hide" the element I simply switch the pages via SetAttrs() - not SetGadgetAttrs(), to avoid an unnecessary refresh - and then invoke WM_RETHINK on the window object.
That's strange. Looks like a bug in button.gadget to me: the class should have ignored the unsupported tag.
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2