Announcement

Collapse
No announcement yet.

ComboBox **** With displaying the right ItemText after Page Jumping!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ComboBox **** With displaying the right ItemText after Page Jumping!

    Hi, Can someone would be kind enough to help me with something?
    I've spent hours on this trying to get something so simple to work.
    I know I've missed something very basic here!!!
    I want a ComboBox to simply display the last item text they picked after it's page jumped.
    It' works going forwards through pages 1,2,3,4 but when you get to page 4 and try to go backwards then this is where everything goes all Pearshaped

    It's nothing complicated, just a simple ComboBox duplicated to each page.
    I've tried even making the ComboBox on a separate page then inheriting it from that page on all my pages 1,2,3,4 but alas, that didn't want to play ball with me either.

    Below, is my code for ComboBox1
    Item Text
    1. :: Select a picture below::
    2. Picture 1
    3. Picture 2
    4. Picture 3
    5. Picture 4

    On Select for the ComboBox1 (pages 1-4)
    Code:
    if e_Selection == 1 then
    Dialog.TimedMessage("Pls select a picture", "No picture selected?.", 2000, MB_ICONINFORMATION);
    elseif e_Selection == 2 then
    Page.Jump("Page1");
    elseif e_Selection == 3 then
    Page.Jump("Page2");
    elseif e_Selection == 4 then
    Page.Jump("Page3");
    elseif e_Selection == 5 then
    Page.Jump("Page4");
    end
    So, whats the problem?

    Well, as soon as AMS opens up. You can select in order picture 1 - 4 and it works fantastic.

    It even page jumps to the correct pages 1,2,3,4 however, It doesn't show in the ComboBox select text after they've selected the picture the actual text "Picture x" it says :: Select a picture below:: which i can live with. But prefer to to say what it actually is.

    Now, lets say the user has gone through selection 1,2,3,4 [I can only produce this error if I've gone through all selections 1 -4 before this next part]
    Once you've selected picture 4 then decide to go backwards 4,3,2,1 here's where mayhem kicks in!

    It still page jumps perfectly to the correct pages, but the ItemText goes completely out of whack with what page its on. And now instead of displaying :: Select a picture below:: it now displays Picture X but completely out of sync.

    Here's the order of chaos it goes in.

    You have to select picture 1,2,3,4 then go backwards to picture 3

    On selecting picture 3 it pages jumps to page 3, but says picture 4 in the ComboBox?
    On selecting picture 2 it page jumps to page 2, but says picture 1 in the ComboBox?
    On selecting picture 1 it page jumps to page 1, but says picture 3 in the ComboBox?

    This also happens if you go in reverse, start off with 4,3,2,1 then go back to picture 2.

    I just want it to display the correct ItemText in the Combobox the user selected regardless. Or, if that can't be done to at least just display :: Select a picture below:: after they've selected anything. Am I trying to do the impossible?

  • #2
    Originally posted by colc View Post
    ...
    I've spent hours on this trying to get something so simple to work.
    I know I've missed something very basic here!!! ...
    LOL, having a Homer Simpson moment there, colc? Welcome to my world!

    It's kind of hard to follow everything you've outlined here, mate. I'm getting the gist of your project setup, and it does sound like something quite simple, yes. But would much easier to track your line of thought with the apz on hand. So, if you don't mind making your apz public, upload and I'll take a look. If u wanna keep it private for the time being, but don't mind me looking at it, just drop a link into my PM box and I'll take a look at it from there.

    Comment


    • #3
      Sorry mate, the Project is on my other OS,only code on this so made small example for you
      Combobox Prob.apz
      I know it's a complete brain fade on my part LoL

      Comment


      • #4
        Ah, okay. Yes, I see the problem. It's an issue with shifting ComboBox indices that get out of whack, once you start making selections that don't follow a linear order. It can be a difficult thing to wrap your head around, initially. It's similar to the concept of removing items from a multi-select Listbox where you encounter shifting index numbers. I'll have a closer look tomorrow night when I'm less tired and better able to think properly. Will get back to you.

        Comment


        • #5
          Okay, I'm back.

          Have taken a good long look at this and honestly, it has me puzzled. It's not about shifting indices as I initially thought. To get the ComboBox to display the correct item-text regardless of selection order, the obvious answer is to run a ComboBox.SetSelected command on each of the Page On Show events. That way after each PageJump, when it lands on the new page, the ComboBox gets updated to reflect whatever was selected.

          The problem is that when you do this, the whole application just locks up. And that has me baffled. I'm beginning to wonder if there's not actually a bug with the ComboBox object???

          I've tried a hundred ways to sunday to fix this but to no avail. No matter what variations in approach I use, the application ends up locking up. Even thought it might have something to do with the use of e_Selection as an event variable, so coded from a different approach. But the end result is the same - the application locks up.

          Have a look at my modded-version of your apz (attached below). You'll see I've replaced your ComboBox On Select code, for each page, with this:

          Code:
          nIndex = ComboBox.GetSelected("ComboBox1");
          
          if nIndex == 1 then
              Dialog.TimedMessage("Pls select a picture", "No picture selected?.", 2000, MB_ICONINFORMATION);
          else
              Page.Jump("Page"..nIndex-1);
          end
          And placed the following code on each page's On Show event:

          Code:
          ComboBox.SetSelected("ComboBox1", nIndex);
          Notice how it locks up the application and must be shut down from the Task Manager? This has me perplexed. As far as I can tell, it shouldn't be doing this. Maybe someone else can take a look with fresh eyes because I'm at a loss, here.
          Attached Files

          Comment


          • #6
            Edit,
            Just an update for anyone else looking into this.

            The above-described problem with the ComboBox causing things to 'lock up' has been resolved. It's another AMS version-specific issue. The APZ attached directly above will work perfectly on AMS v8.5.0.0 and above. Anything from v8.0.5.0 and backwards will result in application lockup. Whatever was buggy about the ComboBox in these earlier versions was fixed some time after v8.0.5.0.

            Just an F.Y.I.

            Comment


            • #7
              I tested it for you in 8.2 and it works fine for me no lock ups and I do make sure I put it to it's tests lol
              Plugins or Sources MokoX
              BunnyHop Here

              Comment


              • #8
                do not make any changes to your project
                just add an empty dialog to your project
                boom
                solved !!!!

                Comment


                • #9
                  i misunderstood you
                  sorry
                  every page. keeps in its mind the last state of the combo box that located inside it
                  if you use the pages events to adjust the selection on combo boxes
                  you will go into infinite inner loop
                  ignore my previous post

                  Comment


                  • #10
                    Originally posted by startup View Post

                    if you use the pages events to adjust the selection on combo boxes
                    you will go into infinite inner loop
                    Re-read the thread more carefully. This was a bug in the ComboBox pertaining to v8.0.5.0 and earlier. We do not know the exact version when this bug was fixed. But we do know the fix occured sometime after v8.0.5.0 and before v8.2. In any case, if you're using the latest version of AMS, you won't have this problem.

                    Comment


                    • #11
                      ok
                      forget ams version !!

                      lets dance
                      in colc apz
                      put this function in global functio
                      ns


                      Code:
                      function SetSelectTo_1()
                      Page.SetObjectScript("ComboBox1", "On Select", "");
                      ComboBox.SetSelected("ComboBox1", 1);
                      script = [[if e_Selection == 1 then
                      Dialog.TimedMessage("Pls select a picture", "No picture selected?.", 2000, MB_ICONINFORMATION);
                      elseif e_Selection == 2 then
                      Page.Jump("Page1");
                      elseif e_Selection == 3 then
                      Page.Jump("Page2");
                      elseif e_Selection == 4 then
                      Page.Jump("Page3");
                      elseif e_Selection == 5 then
                      Page.Jump("Page4");
                      end]]
                      Page.SetObjectScript("ComboBox1", "On Select", script);
                      end
                      then call it in every page in the event "ON Show"

                      Comment


                      • #12
                        after this you can also delete all code inside the on selection in the combo boxes

                        Comment


                        • #13
                          I don't need to put colc's code into Globals.
                          The bug has already been diagnosed quite thoroughly, via:

                          Globals:
                          Code:
                          nIndex = 0;
                          Page On Show:
                          Code:
                          if nIndex ~= 0 then
                              ComboBox.SetSelected("ComboBox1", nIndex);
                          end
                          ComboBox On Select:
                          Code:
                          nIndex = ComboBox.GetSelected("ComboBox1");
                          
                          if nIndex == 1 then
                              Dialog.TimedMessage("Pls select a picture", "No picture selected?.", 2000, MB_ICONINFORMATION);
                          else
                              Page.Jump("Page"..nIndex-1);
                          end
                          The relevant apz for testing is attached at Post #5, here:


                          Tested on plural systems running v8.5+ and confirmed via Rex on v8.2.
                          Slow down and re-evaluate, so we don't muddy the waters unnecessarily, eh?

                          Comment


                          • #14
                            ok
                            no proplem
                            i just wont to give colc a solution. that can be run at any ams version !!

                            Comment


                            • #15
                              Well, I'm sure that colc will be thankful to hear that. As the code you posted will result in a failure of the Dialog.TimedMessage to show up on the buggy versions, anyway.

                              You've missed the point, here. We were not looking for a 'workaround' to the versions of AMS with a buggy ComboBox. Rather, we were seeking to establish the reason for the failure of the ComboBox in the first place. And to that end, this cause was clearly established. Hence, my request for you to re-read the thread more carefully.

                              Sigh ... given that you now seem to be packing up your toys and leaving the sandbox, I just might do the same.
                              LOL, I'm outta here, folks. See y'all another night when my patience has returned to its normal tolerant levels.

                              PS.
                              And what's with all the giant, bold typing, eh? No need to shout, brother - we're not deaf.
                              Just dumb.

                              Comment

                              Working...
                              X