Announcement

Collapse
No announcement yet.

MagicMove slide form?

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

  • MagicMove slide form?

    Hi,
    I use the gen4-uLCD-32DCT-CLB, is it possible to slide to a form to another form only by sliding finger?

    If so, is it possible to provide me with the code?

    Thanks

    Best

    Christ



  • #2
    Hi Christ,

    Yes. It is possible to use MagicMove to switch forms using the ActivateForm() function.

    You may try the attached example as reference.

    More information about the VisiGenie Magic codes can be found in the VisiGenie Reference Manual under Section 6.
    Just click on a form and press F1 to open it.

    Best Regards,

    Eran
    Attached Files
    Eran

    Comment


    • #3
      Hi Eran,

      I will test the project that you refer me and I give you news!

      Thank you for your help!

      Best Regards

      Chris

      Comment


      • #4
        Hi Eran,

        I tested the program and it works very well!

        But I add a form is it does not work well, when I go from form to form1 it works but I automatically go to the form2 without slide the fingers ??

        here is the code that I modify to add a form:

        var form;
        if(form ==0)
        form := 1;
        ActivateForm(1);
        pause(500);

        else if(form == 1)
        form := 0;
        ActivateForm(0);
        pause(500);

        endif

        if(form ==1)
        form := 2;
        ActivateForm(2);
        pause(500);

        else if(form == 2)
        form := 1;
        ActivateForm(1);
        pause(500);

        endif

        Thanks for help

        Chris

        Comment


        • #5
          Originally posted by tech View Post
          Hi Eran,

          I tested the program and it works very well!

          But I add a form is it does not work well, when I go from form to form1 it works but I automatically go to the form2 without slide the fingers ??

          here is the code that I modify to add a form:

          var form;
          if(form ==0)
          form := 1;
          ActivateForm(1);
          pause(500);

          else if(form == 1)
          form := 0;
          ActivateForm(0);
          pause(500);

          endif

          if(form ==1)
          form := 2;
          ActivateForm(2);
          pause(500);

          else if(form == 2)
          form := 1;
          ActivateForm(1);
          pause(500);

          endif

          Thanks for help

          Chris
          im unable to test this but i can point you in a direction
          if your changing the forms incrementally your condition statement is wrong, try this?


          var form;
          if(form ==0)
          form := 1;
          ActivateForm(1);
          pause(500);

          else if(form == 1)
          form := 2;
          ActivateForm(2);
          pause(500);

          else if(form == 2)
          form := 0;
          ActivateForm(0);
          pause(500);

          endif

          Thanks for help

          Chris

          Comment


          • #6
            Hi Chris,

            The reason why your form switches to form 2 is because you have also put this condition:

            Code:
            if(form ==0)
            form := 1;
            ActivateForm(1);
            pause(500);
            
            endif
            
            if(form ==1)
            form := 2;
            ActivateForm(2);
            pause(500);
            Remember that using two 'if' conditions is different from using one 'if' with one or more 'else if's. Therefore, as you slide towards form 1, it will switch automatically to form 2 for it tests again whether your second 'if' condition is met. In your code, what happens is that as you switch to form 1, it will automatically satisfy your second if(form==1) condition, thus switching to form 2 follows.

            You can use the code that tonton81 has suggested.

            If you want to add more forms, then you can add another 'else if' condition.


            If you want to know and play more about the if and else if conditions, you can try this code:

            This code will allow you to go to form 1 from form 0 when you swipe to the left; correspondingly, it switches from form 1 to form 0 when you swipe to the right.
            Code:
            var form, x1, x2;
            
            if(x2 == 0)
                x2:= TouchXpos;
            else if(x2 != 0)
                x1 := TouchXpos;
                if(x2>x1)               // slide to the left
                    if(form ==0)
                        form := 1;
                    else if(form == 1)
                        form := 2;
                    else if(form == 2)
                        form := 0;
                    endif
                pause(500);
                ActivateForm(form);
                x2 := 0;
            
                else if(x2<x1)           //slide to the right
                    if(form ==0)
                        form := 2;
                    else if(form == 1)
                        form := 0;
                    else if(form == 2)
                        form := 1;
                    endif
                pause(500);
                ActivateForm(form);
                x2 := 0;
                endif
            endif
            Hope it helps and regards,

            Eran
            Eran

            Comment

            Working...
            X