HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Author Topic: possible improvement of CleanEngine code: _GUITabClassMethods  (Read 1697 times)

AWW_boss

  • General Accounts
  • *
  • Posts: 846
  • gdfgd
    • View Profile

Hi, i noticed that when i'm using tabbed windows, i get a _onTabPanelActivate event, for the stuff that needs to be done when the tab gets visible, but i don't have any _onTabPanelDeactivate event, for the stuff that needs to be done when the tab gets invisible

To fix this, a simple addition to the clean engine code could be done, in _GUITabClassMethods, method _activateTabContentPanel, add the bold part:

method _activateTabContentPanel()
  if hasMethod(me, "HE_activateTabContentPanel")
    me.HE_activateTabContentPanel()
    return
  .
  var contentPanel = me._getTabContentPanel()
  assert(contentPanel != None, "Could not find ownedPanel for tab: " + me.name)
  var clientarea = contentPanel.parent
  assert(clientarea != None, "Could not find parent of ownedPanel: " + contentPanel.name + "!")
  foreach panel in clientarea.children
    if panel != contentPanel
      //added this to clean engine code to be able to handle some cleanup scenarios
      if (hasMethod(panel, "_onTabPanelDeactivate") and (panel.visible = true))
        panel._onTabPanelDeactivate()
      .
      //

      panel.visible = false
    .
  .
  if hasMethod(contentPanel, "_onTabPanelActivate")
    contentPanel._onTabPanelActivate()
  .
  contentPanel.visible = true
  add back contentPanel to clientarea.children
  forceLayout(clientarea)
.



Cheers!
Logged