Announcement

Collapse
No announcement yet.

conect 2 or more visi surfaces

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

  • conect 2 or more visi surfaces

    i can't find out how to combine 2 diffrent visi surfaces.
    for explain: i have a digital clock and when sb touch the display it should switch to a option surface.
    so i created a clock and an option window - how can i combine these 2 programs?
    thx

  • #2


    If you have set up two separate programs and you want one to call the other, there are examples of how to do this in the samples folder. (Sorry, no Visi sample of this is available yet)



    If you are doing it in one program then the current release of Visi supports multiple forms in one program
    Mark

    Comment


    • #3


      does it mean i can design several forms in one programm?

      if it's so, how do i do that?

      Comment


      • #4


        Have a look at the kbMultiForms Example.



        You add an extra form by clicking on the 'blank form' on the 'System' Tab
        Mark

        Comment


        • #5


          hi i have looked at the examples.

          and i've found the blank form thx.

          now i've created a program with 2 forms every form is an own function but when i switch to the second form, i can still see the digits from the first form?

          and i can't use the buttons of the second form???

          func main()
          ...
          touch_Set(TOUCH_ENABLE); //schaltet touchscreen ein

          state := touch_Get(TOUCH_STATUS);
          x := touch_Get(TOUCH_GETX); // neu
          y := touch_Get(TOUCH_GETY); //neu

          if(state == TOUCH_PRESSED)

          if(x > 0 && y > 0) //neu
          option();
          endif
          endif

          forever


          endfunc

          func option()
          ...
          touch_Set(TOUCH_ENABLE);

          state := touch_Get(TOUCH_STATUS);
          x := touch_Get(TOUCH_GETX); //neu
          y := touch_Get(TOUCH_GETY); //neu

          if(iWinbutton3 == TOUCH_RELEASED)

          main();
          endif

          if(iWinbutton1 == TOUCH_RELEASED)

          ....
          thx stricker

          Comment


          • #6


            can somebody catch this problem?

            why can i see the digits from the first form ,when the programm is swiched in the second form??

            thx stricker

            Comment


            • #7


              You don't appear to have pasted the generated code and/or pasted it into the correct place.



              Note, if you have buttons on multiple forms then you need to img_Disable at the 'end' of a form, as well as the

              img_SetWord(hndl, iWinbutton1, IMAGE_FLAGS, (img_GetWord(hndl, iWinbutton1, IMAGE_FLAGS) | I_STAYONTOP) & ~I_TOUCH_DISABLE); // set to enable touch, only need to do this once


              at the 'start' of the form.
              Mark

              Comment


              • #8


                ok now i kwon what you mean with the right place!

                but i can't see any img_Disable commands in the multi Form example??

                I'm sorry for so much questions but i must finish the programm till the beginn of

                april!

                thx stricker

                Comment


                • #9


                  Look up img_Disable in the internal finctions reference manual.



                  It's not used in the example, the example is so simple it wasn't needed (and perhaps it should have been there to help you understand a but better)
                  Mark

                  Comment


                  • #10


                    hi
                    i tried this disable command but it doesn't work. and i can't see the fault?

                    img_Show(hndl, iCustomdigits1); // show all digits at 0, only do this once
                    ledDigitsDisplay(numh, iCustomdigits1+1, 80, 2, 2, 9, 0 ) ;

                    numh := 0 ;
                    numm := 0 ;

                    //touch_Set(TOUCH_ENABLE); //schaltet touchscreen ein

                    repeat

                    numm ++ ;
                    if (numm == 60)
                    numm := 0 ;
                    numh ++ ;

                    if (numh == 24)
                    numh := 0 ;

                    endif
                    ledDigitsDisplay(numh, iCustomdigits1+1, 80, 2, 2, 9, 0 ) ;
                    endif
                    ledDigitsDisplay(numm, iCustomdigits2+1, 152, 2, 2, 9, 0 ) ;
                    pause(6000) ;

                    touch_Set(TOUCH_ENABLE); //schaltet touchscreen ein
                    state := touch_Get(TOUCH_STATUS);
                    x := touch_Get(TOUCH_GETX); // neu
                    y := touch_Get(TOUCH_GETY); //neu

                    if(state == TOUCH_PRESSED)

                    if(x > 0 && y > 0) //neu
                    option();
                    numm := img_Disable(hndl,iCustomdigits2);
                    endif
                    endif
                    forever

                    the first problem is i have to touch the display for several seconds before it reacts and the customdigits doesn't disable!

                    thx

                    Comment


                    • #11


                      You've got a pause(6000) in the main loop, which will cause the responsiveness to be extremely delayed. (You also reenable the touch every loop iteration, no idea why)



                      The code simply disables customdigits2 when anything is touched. without any idea what you are trying to do this just doesn't look right. Where have you disabled everything on the first form? Where have you initialised and displayed the second form?
                      Mark

                      Comment


                      • #12


                        oh yap to reenable the touch every loop was a copy-past fault!

                        yes i know that it's disables customdigits2 that was just a test if it's work.
                        and it doesn't!

                        and the second form is displayed in the second function?!
                        ...
                        state := touch_Get(TOUCH_STATUS);
                        x := touch_Get(TOUCH_GETX); // neu
                        y := touch_Get(TOUCH_GETY); //neu

                        if(state == TOUCH_PRESSED)

                        if(x > 0 && y > 0) //neu

                        option();
                        numm := img_Disable(hndl,-1);
                        endif
                        endif
                        forever
                        endfunc

                        func option()
                        // Form2 generated 03.02.2012 13:38:08

                        // Label2 generated 03.02.2012 13:38:08
                        txt_FontID(FONT3) ;
                        txt_FGcolour(RED) ;
                        txt_BGcolour(BLACK) ;
                        gfx_MoveTo(90, 12) ;
                        putstr("Optionen") ;
                        ...

                        Comment


                        • #13


                          You were disabling iCustomdigits2 after calling option(), that didn't make sense to me.



                          Also you need to have some code like

                          n := img_Touched(hndl,-1) ;

                          so you can work out what is really being touched (i.e. compare n to iCustomdigits2, or whatever, see the samples, or the manual), just responding to a tocuh pressed could be responding to any touch anywhere.
                          Mark

                          Comment


                          • #14


                            yes i know i've tried to disabling before and after...and many more

                            and when i just do: img_Disable (hndl,-1);
                            option();
                            then the programm disables images (but not the labels ???) from the 2nd form not from the first?
                            my problem is to disable images and labels.
                            but i don't know what the problem is?

                            Comment


                            • #15


                              i mean like that

                              if(state == TOUCH_PRESSED)

                              if(x > 1 && y > 1) //neu
                              img_Disable(hndl,-1);
                              option();
                              endif
                              endif

                              Comment

                              Working...
                              X