Welcome, Guest
  • Author Topic: Xml Tree selecting different functions ???  (Read 436 times)

    aktell

    • Server what's that
    • *
    • Posts: 16
      • View Profile
      • Email
    Xml Tree selecting different functions ???
    « on: 04/22/12, 19:53 »
    Hi there,

    I have this Xml Tree ViewStack set up which works fine now for many month as it is, but I do need to do more with it, and I have the problem that I can't work it out the way it should preform using IF or a Switch.
    Maybe somebody had come across a similar problem ???

    Any help would be appreciated ! regards aktell

    Code: [Select]
    ........
    if (showThisView != "") {

    myViewStack.selectedChild = this[showThisView];

    I need to address every time a different function I select a different
    Node in this Tree.

    e.g.
    myViewStack.selectedChild == 0 .... ??? - function DO THIS
    myViewStack.selectedChild == 1 .... ??? - function DO THAT
    etc.

    }
    ........

    Jorge Solis

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 14616
      • View Profile
    Re: Xml Tree selecting different functions ???
    « Reply #1 on: 04/23/12, 04:31 »
    A switch look like this

    Code: [Select]
    switch(myViewStack.selectedChild){
        case 1:
            //do something
            break;
        case 2:
           //do something
          beak;
       ( .....  etc .... )
         default:
           //do something
    }

    Jorge

    aktell

    • Server what's that
    • *
    • Posts: 16
      • View Profile
      • Email
    Re: Xml Tree selecting different functions ???
    « Reply #2 on: 04/23/12, 18:40 »
    Hi there,

    Thanks a lot for the reply I know what and how a switch works, and I have tried this one as well yet it did not worked ! But I will give it another try and let you know. regards aktell