15 September 2019, 07:55 | #1 | |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 284
|
How to remove/hide any gadget from window (gadtools)
Hi,
is there a way? I did some searching and found this: Quote:
At the beginning I used one of these: Code:
RemoveGadget() RemoveGList() Code:
RefreshGadgets() RefreshGList() Code:
RefreshGadgets() GT_RefreshWindow() |
|
15 September 2019, 16:41 | #2 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,028
|
Use RemoveGList, EraseRect to hide the gadget, AddGList, RefreshGList to show it.
|
15 September 2019, 18:53 | #3 |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 284
|
Thanks for the answer.
Anyway I still have a problem with it. Look at the movie. There is a window with buttons on top, one listview under and one more button at the bottom. There is a "LIST" gadget which I click in the movie and all it does is: - RemoveGList(for listview and bottom gadget only) - EraseRect(only ereases listview) Now if I click on bottom gadget it doesn't respond so it is gone - good! But when I click on Listview ... it is still alive (actually in the movie, first, I click on the listview and later on the bottom gadget) Am I missing something? Thanks [ Show youtube player ] |
15 September 2019, 20:33 | #4 |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 284
|
What I actually want to do is to make a toggle button to change my window size thus I wanted to hide viewlist and bottom gadget and then adjust window's size to accommodate only top row of gadget and white information bar.
In that case, do I really have to get rid of these gadgets from glist and then resize the window? Or is it safe to just resize the window and leave the gadgets outside ? |
16 September 2019, 08:45 | #5 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,028
|
The problem is that Gadtools gadgets are not BOOPSI objects which means a Gadtools gadget can consist of multiple Intuition gadgets and you have to remove them all from the list. At the same time Gadtools gadgets should be considered black boxes so you can never be sure how many Intuition gadgets belong to one Gadtools gadget.
If you put the gadgets to be removed to the end of the glist, you can use RemoveGList with -1 as count. Then it will remove all gadgets until the end of the list. In order to remove a gadget in the middle of the list you could remember the pointers you got from CreateGadget and count the number of gadgets in between by following the NextGadget pointers. Or use the brute force method: remove all gadgets from the window, free the whole glist and rebuild it with only the gadgets which should remain. |
16 September 2019, 09:00 | #6 | |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 284
|
Thanks for clarification.
So far I do have exactly what you are saying (When using CreateGadget I keep the pointers to individual gadgets and then I tried these with RemoveGList() and the proper count - that was on the movie). Quote:
Code:
RemoveGList_(*win,*gadlv,-1) maybe there is something wrong in my code. I think I'm going to leave it as it is - I will just add WA_Zoom to NewWindow structure to get zoom gadget an after zapping the window ListView and "prefs..." button will stay out of the reach. Last edited by peceha; 16 September 2019 at 09:11. |
|
17 September 2019, 06:35 | #7 | ||
Registered User
Join Date: Mar 2018
Location: Hastings, New Zealand
Posts: 2,742
|
Quote:
Quote:
All the gadgets can stay in place. You can't click on them while they are hidden, and Intuition will refresh them automatically when the window is zoomed back out again. |
||
17 September 2019, 07:47 | #8 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,028
|
Make sure that you set GFLG_GIMMEZEROZERO, otherwise part of the gadgets will draw over the borders.
|
17 September 2019, 23:28 | #9 | |
Registered User
Join Date: Oct 2012
Location: Germany
Posts: 585
|
Quote:
- Let's assume we have three Gadget "groups" A,B,C, containing 1-n Gadgets - Call CreateContext() and save the returned Gadget pointer, - Create all Gadgets with CreateGadgetA() in one go, but - GadTools will create lots of sub-gadgets and the individual Gadget pointers returned by CreateGadgetA will only refer to the last of them. So you need to store the pointer to the first Gadget separately, e.g. "B_First =A_Last->NextGadget". - I also saved the number of all "real" Gadgets per group for convenience. - Next step is to cut out the individual Gadget lists by unlinking them. So we set A_Last->NextGadget = NULL, B_Last->NextGadget = NULL, etc. - Now we can remove a Gadget group by calling RemoveGList(A_First,...), RectFill(<region of the gadget group to be removed>) - To display the next gadget group we use AddGList(B_First,...), RefreshGList(<pointer returned by CreateContext>), GT_RefreshDisplay() - To clean up after the window has been closed, we need to link all the GadgetLists back together, like this "A_Last->NextGadget = B_First", etc. And finally call FreeGadgets(<pointer returned by CreateContext()>) Hope this helps. |
|
18 September 2019, 08:45 | #10 |
Registered User
Join Date: Dec 2017
Location: Poland
Age: 47
Posts: 284
|
Thanks!
I understand what you just wrote. Will try something like this shortly (worked for you, should work for me) At the moment, I left gadget list untouched (only made window smaller) but will play more. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hide AmiTCPIP Log Window | eva | support.Apps | 5 | 19 November 2014 15:30 |
gadtools | zharn | Coders. C/C++ | 6 | 21 February 2014 20:26 |
How to add an Iconify-Gadget to a Window? | AGS | Coders. System | 5 | 15 January 2014 15:41 |
Soft which hide whole border of AmigaDos Window | olesio | support.Apps | 5 | 17 February 2009 01:21 |
Gadget/Layout.gadget V44 | ruliovega | support.Apps | 6 | 02 January 2006 11:50 |
|
|