Ticket #375 (closed enhancement: fixed)
Can't show/hide widgets from containers
| Reported by: | totycro | Owned by: | chewie |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.3.4 |
| Component: | engine/extensions/pychan | Version: | trunk |
| Severity: | normal | Keywords: | show hide container pychan |
| Cc: | Blocked By: | ||
| Blocking: | Time planned: | ||
| Time remaining: | Time spent: |
Description
Use case:
In an xml file, there is a widget as part of a container. This widget should be visible in some cases, in others not. Calling show()/hide() on it gives this: "You can only show/hide the top widget of a hierachy."
The proposed solution is to use add/removeChild, which is not possible here, since removeChild would remove all information, that the gui designer put into the xml file.
Please implement show/hide for non-top level widgets if easily possible, or provide another mechanism for setting visibility, that works in this case.
Attachments
Change History
comment:2 Changed 4 years ago by totycro
So can i just retrieve the container via findChild, and save it? I thought i´d have to reconstruct the widget to add it again. If it works this way, please close this ticket (i don´t have the privileges for this)
Changed 3 years ago by chewie
-
attachment
pychan_hide_show_widget_IRC.txt
added
#fife IRC discussion on how to solve this problem
comment:5 Changed 3 years ago by prock
- Type changed from defect to enhancement
- Milestone changed from 0.3.1 to 0.3.2
This is an enhancement. Moving to 0.3.2.
comment:6 Changed 3 years ago by prock
- Milestone changed from 0.3.2 to 0.3.3
No time for 0.3.2... moving to 0.3.3
comment:8 Changed 20 months ago by prock
(In [3770]) * Pychan widgets can now be shown/hidden even if they are not top level containers. There is one drawback with this implementation and that is when you modify the container widget after you hide a widget. The widget is not guaranteed to come back in the same spot you would expect it to. This only happens when you modify the container widget. I'm keeping this ticket open so people can test.
- Added a Show Hide test to the PychanTest? module in fife_test.
- Added some more tiles to the rpg tileset in fife_test. refs #375
comment:9 Changed 20 months ago by prock
adding to the commit comments I had made... The widget will remember it's position when you hide it... if you remove/hide several other widgets in the same container that position becomes invalid and the behavior when you show the widget is undefined. It may end up in the same spot or it may end up later on in the widget order.
comment:10 Changed 20 months ago by prock
comment:11 Changed 20 months ago by prock
- Status changed from new to closed
- Resolution set to fixed
Closing ticket.

What exactly is missing after remove-/addChild? So far I didn't notice problems here. As an example, I'm using this method in the ObjectEdit? plugin to toggle visibility of the animation panel once an animated instance is selected. (the gui is defined and layouted via an xml file)