Can someone please explain to me how the changing of a layout content works when you have a list browser with selections?
This is something that is done on both GUI and Internet prefs. At the left side there is a listbrowser with options and at the right side the content changes depending the selected option from the left side.
What is the idea behind this? Does it detach a whole layout and attach an other at the right side? Do I understand it right?
I am not sure I totally understand your question. So I will try to go by assumption of a layout set with a horizontal divide. So the selection list is on left and based upon what you select it shows a component or child layouts on the right.
To do that you basically create your layout put the listbox on the first child and add all the others you want to the child on right and toggle visibility of the component/layout based upon the selection in the listbox. You might need to call Rethink and it will update the displayed layout. Now if you do something really heavy you may destroy the child and create new component/layout and add it back into the layout but for most part you can just pull it off with visibility.
Is this what your asking?
DStastny
I need to read better. And look at examples you sited. I looked at some old code and remembered there is no easy way to just make a element visible or not by toggling attribute. There is GA_Hidden but I have never been able to figure out what it does. I will post example for you though. That works by adding and removing children from layout on the fly. It works but I am embarrassed to post it cause cause its a cobbled mess of cut-paste. Ill put it up hopefully later tonight.
Regards
DStastny
This is one method. Use this if you really have highly dynamic contents.
The better, but more static, way probably is to use a page gadget on the right and define all layouts as pages. Similar to the clicktab/page combination you can use a listbrowser/page combination. The difference is that the listbrowser does not have its own support for pages. You'll have to use ICA_TARGET and ICA_MAP attributes to let the listbrowser switch pages automatically.
As promised a example of switching using a simple button but that could be layouts to swap. This example flags the buttons to not dispose on remove so they only get created once but if its real dynamic you could just destroy and reattach.
As Thomas said you can use page.gadget as well.
DStastny
Thank you so much guys for the explaination.
The solution with the pages seems valid, but I didn't know that you can do it without the tabs.
I will see what is more suitable for my project and I will get back to you.
Thanks again
@thomas
To do the ICA_MAP I need to get the index of the clicked node from the listbrowser.
Any idea what the ?????? at the above should be? Which ListBrowser attribute would return the selected node?
Thank you for your help.
LISTBROWSER_Selected
The documentation is misleading because it says the attribute would set the selected node. This is only true for OM_SET, but it also supports OM_GET and OM_NOTIFY in which case it returns the selected node.
https://wiki.amigaos.net/amiga/autodocs/listbrowser_gc.doc.txt
Oh my god. Thanks Thomas.
On the autodocs I have here this is marked as BOOLEAN. Will test it and hope it works.
Yeap, it worked flawlessly. I ICA_TARGET and ICA_MAP and the page gadget and works very nice.
Thank you guys for your help.