Ticket #375 (closed enhancement: fixed)

Opened 5 years ago

Last modified 3 years ago

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

pychan_hide_show_widget_IRC.txt (7.2 KB) - added by chewie 5 years ago.
#fife IRC discussion on how to solve this problem

Change History

comment:1 Changed 5 years ago by chewie

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)

comment:2 Changed 5 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)

comment:3 Changed 5 years ago by prock

  • Milestone changed from Proposal to 0.3.1

comment:4 Changed 5 years ago by chewie

  • Owner changed from FIFE to chewie

Changed 5 years ago by chewie

#fife IRC discussion on how to solve this problem

comment:5 Changed 5 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 4 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:7 Changed 3 years ago by prock

  • Milestone changed from 0.3.3 to 0.3.4

moving to 0.3.4

comment:8 Changed 3 years 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 3 years 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 3 years ago by prock

(In [3771]) * This is a little closer to the final solution. Now it stores a cache of the widget positions to ensure that the when you hide and show a widget it shows up in the exact spot it was. Note that this implementation can probably be optimized a bit. refs #375

comment:11 Changed 3 years ago by prock

  • Status changed from new to closed
  • Resolution set to fixed

Closing ticket.

Note: See TracTickets for help on using tickets.