Show groups of objects from single event

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • pjvbh
    Indigo Rose Customer
    • Sep 2002
    • 12

    Show groups of objects from single event

    Hi:

    I would like groups of text objects to show/hide from a single click on a hotspot.

    For example, I might have text objects named

    Text00_0
    Text00_1
    Text00_2

    Text01_0
    Text01_1

    etc

    ... and a %textGroup% variable set by a mouse click to 00, 01, etc.

    ... and then something like:

    Page.ShowObject=("Text + %region% + *")

    Can a string be made to concatenate "Text" + %textGroup% + wildcard characters and then used with a single SHOW action?

    Thanks,
  • Lorne
    Indigo Rose Staff Member
    • Feb 2001
    • 2729

    #2
    Re: Show groups of objects from single event

    Nope. The actions don't support wildcards for the object names at all.

    But, you can definitely concatenate text with an expression (using a "Variable - Set Value" action), or even just mix-n-match the variable with the text to form the value you want.

    If you only have a few objects, it'll probably be easier to just use separate Show and Hide actions for them.

    If you have a lot of objects, though, you could try using a While loop, like this one that would hide 10 objects:

    <pre>%i% = 10
    WHILE (%i%)
    Page.ShowObject=("Text%region%%i%")
    %i% = Evaluate(%i% - 1)
    END WHILE</pre>
    --[[ Indigo Rose Software Developer ]]

    Comment

    • Lorne
      Indigo Rose Staff Member
      • Feb 2001
      • 2729

      #3
      Re: Show groups of objects from single event

      In fact, here's an example that will show you how it works. [img]/ubbthreads/images/icons/smile.gif[/img]

      11388-Dynamic show and hide.am4
      --[[ Indigo Rose Software Developer ]]

      Comment

      • pjvbh
        Indigo Rose Customer
        • Sep 2002
        • 12

        #4
        Re: Show groups of objects from single event

        Lorne:

        Thanks very much for the WHILE loop example; it tells me everything I need to know for this page!


        Comment

        • Lorne
          Indigo Rose Staff Member
          • Feb 2001
          • 2729

          #5
          Re: Show groups of objects from single event

          You're welcome Phillip. [img]/ubbthreads/images/icons/smile.gif[/img] I was curious to see if it would work. [img]/ubbthreads/images/icons/wink.gif[/img]
          --[[ Indigo Rose Software Developer ]]

          Comment

          • pjvbh
            Indigo Rose Customer
            • Sep 2002
            • 12

            #6
            Re: Show groups of objects from single event

            ... From the should work but doesn't department :-)

            OK, I can't see why this (see attached) does not work.

            The WHILE loop that hides the objects is never executed, but I cannot see while the condition is not met. Is there some other factor getting in the way here?

            Hope I have attached this list correctly ...



            11571-actionlist.txt

            Comment

            • Lorne
              Indigo Rose Staff Member
              • Feb 2001
              • 2729

              #7
              Re: Show groups of objects from single event

              You aren't initializing %i% to anything before the WHILE loop. The %i% variable will be seen as that exact text (%i%) and so the >= operator in the expression:

              %i% >= 0

              ...will perform a string comparison between the word "%i%" and the word "0".

              % comes before 0 in the ASCII table, so that test ends up being false right from the get-go.

              That's probably your answer...unless you're initializing %i% some integer larger than -1 somewhere else (i.e. in another action list that happens before this one).
              --[[ Indigo Rose Software Developer ]]

              Comment

              • pjvbh
                Indigo Rose Customer
                • Sep 2002
                • 12

                #8
                Re: Show groups of objects from single event

                Here is the complete action list -- I hope.

                I believe that before the WHILE test runs, %i% will have been set:

                %i% = "1" (or "2", etc, depending which hotspot was clicked)

                Do I need to do that differently to make it an integer rather than a word?

                Anyway, while testing I put a text box on the page and set it to display %i% -- and it looked like a 1 was there before the WHILE condition is tested :-)

                Is the Equal operator not the correct one to test if %i% has the value 1?


                11574-actionlist2.txt

                Comment

                • pjvbh
                  Indigo Rose Customer
                  • Sep 2002
                  • 12

                  #9
                  Re: Show groups of objects from single event

                  I have found my error - the value of i was set -- but then un-set again -- by a previous WHILE loop. I must remember to keep refreshing the values of those test text objects. Oops.

                  Thanks for your help!

                  Comment

                  • Lorne
                    Indigo Rose Staff Member
                    • Feb 2001
                    • 2729

                    #10
                    Re: Show groups of objects from single event


                    Do I need to do that differently to make it an integer rather than a word?
                    Nope. There's actually no difference...AutoPlay figures out what you meant by the context. For example:

                    1 + 1

                    both values are numbers, so an addition is performed: 2

                    1 + tree

                    one of the values is obviously a string, so concatenation is performed: 1tree

                    1.2.4 + 1.0.1

                    the values both have more than 2 decimal points, so a "version addition" is performed: 2.2.5
                    --[[ Indigo Rose Software Developer ]]

                    Comment

                    Working...
                    X