Announcement

Collapse
No announcement yet.

Multi Form App in Visi

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

  • Multi Form App in Visi

    I am working on using the 4D display to control and relatively basic machine via I2C and the GPIO pins so I don’t need an Arduino or anything like that. I will be reading sensors, and controlling outputs over I2C based on analyzing the inputs. Because of the complexity here I am assuming I need to use “ViSi” and not “ViSi-Genie” since I don’t see how to add code to the “Visi-Genie”, is this correct?

    Also, my app will have several forms(attached below). Notice that I have a row of common “function” buttons at the bottom that will never change and the user selects which form they want by pressing them. In “Visi-Genie” the switching between forms seems pretty straight forward using “events”. However, I do not see this on “ViSi” so guess I need to do this manually. Is this correct?

    Click image for larger version

Name:	1850757.png
Views:	163
Size:	195.5 KB
ID:	39611

    In looking through the forums and examples (KBMULTIFORMS) it appears that I may need clear the old screen, disable the touch of the buttons on the previous form when I leave it and then redraw the new form and enable the buttons on the new form. Is this correct? I do not see any “New Form” command or anything, is this correct or do I need to do a img_show(hndl, “FormNameHere”)? I tried to describe it below.



    Code:
    func SwitchScreens()
    
    DisableTouchOfCurrentScreen()
    
    gfx_Cls()
    
    img_show(hndl, “FormNameHere”)
    
    DrawMainScreen(); // Generated code from IDE.
    
    Endfunc


    Ken

  • #2


    Hi kenjustken,

    Because of the complexity here I am assuming I need to use “ViSi” and not “ViSi-Genie” since I don’t see how to add code to the “Visi-Genie”, is this correct?
    Yes, with ViSi you'll have more 'control'.

    Also, my app will have several forms(attached below). Notice that I have a row of common “function” buttons at the bottom that will never change and the user selects which form they want by pressing them. In “Visi-Genie” the switching between forms seems pretty straight forward using “events”. However, I do not see this on “ViSi” so guess I need to do this manually. Is this correct?
    Yes, in ViSi, switching forms is more like showing the right object/s. You just have to know the right index of the object and you can show it anytime you want. If you don't want it shown, either draw something on it or clear the entire screen. Disable the touch detection for that object also. These are illustrated in 4D-AN-P3007 ViSi SOMO-II Multi Form Demo. The application described in that document talks to the SOMO-II thru serial comms. If you don't have a SOMO-II, you can use the hyperterminal utility in Workshop instead. Just download the datasheet for the SOMO-II for the serial commands set. The application note will guide you.

    In looking through the forums and examples (KBMULTIFORMS) it appears that I may need clear the old screen, disable the touch of the buttons on the previous form when I leave it and then redraw the new form and enable the buttons on the new form. Is this correct? I do not see any “New Form” command or anything, is this correct or do I need to do a img_show(hndl, “FormNameHere”)? I tried to describe it below.
    See post above.

    Hope this helps.
    Last edited by Doff; 21st August 2014, 11:15 AM.
    Doff

    Comment


    • #3


      That is the perfect example for me. This will give me lots to work on tonight in Hotel. Thanks.

      Ken

      Comment


      • #4


        In looking at this example, I have a question about the button numbering. In the code below, it assumes that the numbering will be inclusive and between iUserButton17 and IUserButton22. Is this always the case in a form. For instance, if I added 3 buttons on form1 and two buttons on form2 and then went back and added some 2 more buttons on form1, will the tool automatically number the buttons on the form1 from 1...5 verses 1..3 and 6..7 which has a gap between them.

        Also, since I changed the name of the buttons, is there a way to figure out which is the first and which is the last on a from?

        for(_i := iUserbutton17; _i

        Comment


        • #5


          It depends on the order they are added to the form.

          Have a look inside the programnameConst.inc if they are adjacent in there they are inclusive and will remain inclusive.
          Mark

          Comment


          • #6
            In building my app, I have run into a problem. When I try to do a Past Code of the form or Just the form, it does not generate any code other than the comment line for the "Form". It does generate the code for the buttons, text,... When I try to generate the one line of Form code myself it gives me an error saying "iControls" not found. Controls in the name of a "form". I have attached a picture of this. I can also upload my code if you want.

            Ken

            Click image for larger version

Name:	1854245.png
Views:	122
Size:	311.2 KB
ID:	39614

            Comment


            • #7


              The form does not appear to have a background image, similarly the background colour is blank, so past code will not paste any code, there will be no code associated with the form.

              That's why iControls does not exist.
              Mark

              Comment


              • #8


                Thanks. I still have a question then about changing forms. Since I am not using a background color, to change forms I just have to clear the screen, disable the touch on the controls on the controls on the old form and then just draw the controls on the new form. But this kind of suggests that in my case, there is no real "form". It seems that the "forms" are more of an organizational tool more than anything. Can I display controls from two different forms at the same time?

                Ken

                Comment


                • #9


                  Yes and Yes.
                  Mark

                  Comment


                  • #10


                    Thank you. I did not realize this.

                    I had separate buttons on the bottom of my design for each form since I thought the forms were independent. This will allow me to just use one set of buttons at the bottom of the screen that I use to select the different "forms" (main, controls, sensors, stop). Then just redraw the remaining portion of the screen differently for each "form". Am I correct?

                    Ken

                    Comment


                    • #11


                      Yep, that's correct
                      Mark

                      Comment


                      • #12
                        I don't want to hijack this thread -but- is there a guide document that discusses the use of forms?
                        Other than adding a background, what does it give us? Advantages, disadvantages?
                        Also can I assume that if the form contains a background image that anything used within that form will be painted over it?
                        If that were the case and an object were to come and go, does the background need to be refreshed to avoid a shadow where the object once was?

                        Comment


                        • #13
                          When using ViSi (without the Genie) the primary use of forms is to help you visually organize your objects during design, as you can use any objects on any form when running your program.

                          When you have a background image on your form you can restore sections of it using gfx_ClipWindow(), setting clipping on and re showing the background image.
                          Mark

                          Comment


                          • #14
                            When using ViSi (using a uOLED128-G2) how would a form be advantageous to going Clear Screen and throwing up a new page? Sorry, trying to get my head around it to see if it is something I need to learn to use or carry on as usual.

                            Comment


                            • #15
                              Well, for a smaller screen, like the Goldeloxes are, I imagine there would only be one object on the screen at a time and it would occupy the entire screen, so, assuming that, I wouldn't bother clearing the screen at all, I'd just display the 'new' object.
                              Mark

                              Comment

                              Working...
                              X