Announcement

Collapse
No announcement yet.

Forms Navigation Doesn't Work

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

  • Forms Navigation Doesn't Work

    I am struggling to understand forms navigation. I am have an application with five forms, and at the bottom of each page is a winbutton that I want used for navigating the forms.

    I have reviewed app note 4D-AN-00201_R_1_01 and compiled it for use on a GEN4-uLCD-50DT. Here are my observations and questions.

    1) All I get on my display is a blue screen.
    2) When I adapt the code to my application,
    - the Winbuttons visually do not change color when pressed
    - forms navigation does not work.
    3) in this code block
    Code:
    reply := Form1();  //run Form1 initially, get return value
        repeat
            if(reply == iWinbutton1)
                reply := Form2();   //run Form2
            else if(reply == iWinbutton2)
                reply := Form1();   //run Form1
            endif
        forever
    What is being returned in in the first call to Form1()??
    4) In the following code block from Form1()
    Code:
    repeat
    
            _state := touch_Get(TOUCH_STATUS);               // get touchscreen status
            _n := img_Touched(hndl,-1) ;
    
            if(_state == TOUCH_PRESSED)
                if(_n == i4Dbutton1)
    
                    img_SetWord(hndl, i4Dbutton1, IMAGE_INDEX, 1); // where state is 0 for up and 1 for down
                    img_Show(hndl,i4Dbutton1) ;
    
                    img_SetWord(hndl, iUserled1, IMAGE_INDEX, 1) ;      // where numx is 0 (Off) or 1 (On)
                    img_Show(hndl,iUserled1) ;
                endif
    
                if(_n == iWinbutton1)
    
                    img_SetWord(hndl, iWinbutton1, IMAGE_INDEX, 1); // where state is 0 for up and 1 for down
                    img_Show(hndl,iWinbutton1) ;
    
                endif
            endif
    
            if(_state == TOUCH_RELEASED)
                if(_n == i4Dbutton1)
                    img_SetWord(hndl, i4Dbutton1, IMAGE_INDEX, 0); // where state is 0 for up and 1 for down
                    img_Show(hndl,i4Dbutton1) ;
                    img_SetWord(hndl, iUserled1, IMAGE_INDEX, 0) ;      // where numx is 0 (Off) or 1 (On)
                    img_Show(hndl,iUserled1) ;
                endif
    
                if(_n == iWinbutton1)
                    img_SetWord(hndl, iWinbutton1, IMAGE_INDEX, 0); // where state is 0 for up and 1 for down
                    img_Show(hndl,iWinbutton1) ;
                    _returnValue := iWinbutton1;
                    goto exit;
                endif
            endif
    
        forever
    
    
    
    
    exit:
        pause(200);
    
        img_SetAttributes(hndl, i4Dbutton1, I_TOUCH_DISABLE);
        img_SetAttributes(hndl, iWinbutton1, I_TOUCH_DISABLE);
        img_SetAttributes(hndl, Form1, I_TOUCH_DISABLE);
    
    
    
        return _returnValue;
    What is the value/type of the _returnValue in the assignment statement "_returnValue := iWinbutton1;"??
    Last edited by mojoman; 8th August 2018, 02:42 AM.

  • #2
    Hi,

    Did you upload the code to the display without modification?

    If so, I can't replicate the issue you are describing when I ran the appnote project and I am able to switch forms without error.

    If you have modified the code, it would be helpful if you can send your project here so we can determine what could be the cause of the issue.

    With regards to the lines of code you pointed out, initially, all commands under the Form1() function is being executed. This means that Form1 and all the widgets in it will be displayed.

    Once the Winbutton in Form1 is pressed then released, the index of Winbutton1 is stored in _returnValue, thus the line _returnValue := iWinbutton1. The value stored in the _returnValue is then returned and, from the condition in the main function, Form2() function will run.

    Best Regards,
    Kimberly

    Comment


    • #3
      The only modification I made to the code was adapting it to the display I am using...which is the GEN4-uLCD-50DT I mentioned already. I'm on night shift here in Canada, and the computer that this is on is at home. I can post the code I compiled then, however nothing was really changed.

      What I do suspect is an issue is that the screens touch capability is compromised due to a crack in the screen. I'm expecting a new display tomorrow to test this as another app note failed to work properly which demonstrated touch capability .

      Sorry for rambling...it's my first night of 4 and I'm a little foggy.

      Comment


      • #4
        Thanks for the additional information though. Where do I find information about the index value of objects? How is it that _reply := iWinbutton1 is assigning the numeric index value to _reply?? This is valuable information that's not easy to find. I wouldn't have know this without asking.

        Comment


        • #5
          Hi! No worries!

          You may find the object indices by opening the (filename)Const.inc file. Using the appnote code as an example, click this line of code:
          Code:
          #inherit "FormSwitchConst.inc"
          Make sure that the cursor is in between the double quotations then right click and select "open file at cursor".

          The FormSwitchConst.inc will show each object's index. The equivalent numeric value starts at 0, which makes the iWinbutton1's index equals to 3. You may confirm this by printing the iWinbutton1 value by using print(iWinbutton1).

          Keep us posted regarding your test on the new display! Good luck!

          Best Regards,
          Kimberly

          Comment


          • #6
            This is great thank you. As an FYI, I received a new display today that I ordered and it is working fine. The original display had a crack in it, and I am guessing it had issues. I will continue with my work and let you know if any other issues arise.

            Mike

            Comment


            • #7
              You're Welcome!

              We will be very much glad to assist you if you encounter any more issues. Good luck!

              Best Regards,
              Kimberly

              Comment

              Working...
              X