No announcement yet.

addition does not work?

  • Filter
  • Time
  • Show
Clear All
new posts

  • addition does not work?

    Hi everyone,

    I really enjoy working with the 4D system LCD's. It is easy to learn, but now i have i problem which i can not solve myselfe. The problem seems to be quite simpel, but i can not manage it myselve..

    I want to add a value, on a touch on the screen. The screen does react on the screen but the math doesn't work right.

    I have declared two varialbes, named state, and add (var state, add). And want to add them by saying state := state + add;

    When I see the 4DGL programmers reference page 20, this seems to be to correct way.

    Now I want to display the value by checking it's value.

    if (state == 1)
    txt_MoveCursor(12,9), txt_Set(2, 3), txt_Set(0, 0xFFFF), putstr("1");
    end if

    if (state == 2)
    txt_MoveCursor(12,9), txt_Set(2, 3), txt_Set(0, 0xFFFF), putstr("2");
    end if

    The value does not appear in the screen. When i make state an constant, the value does appear. And the touchscreen does work, because i added a routine changing a color of a button, and he does react.

    And i have included an code that state is 1 at startup, and if the last state is reached the first state will become active.

    Can you please help me out?

    ( I am using the uLCD-32032-P1T and workshop 3)

  • #2

    Not sure why you have used , rather than ; to delimit statements, but, anyway, it doesn't seem to cause any problems.

    The problem is

    txt_Set(2, 3)

    You should say somethng like

    txt_Set(FONT_ID, FONT3)

    It's a lot clearer when you use the predefined values, plus you don't accidentally use the wrong thing.

    FONT3 is equal to 2, not 3


    • #3

      Thank you for the reply.

      I do not think this is the problem. When i copy your code and replace it it doesn't compile. When i type txt_Set(

      A hole bunch of option are shown, paremeter 2 says fontsize and this must be size3. So i really think this is not the problem.

      And the text does appear only the math doesn't seem right. It now shows a 2.


      • #4


        Something weird there, Post your complete program


        • #5

          I have found the problem. Seems to be i'm a bit of an idiot ;-)

          I mixed up 2 variables. One detecting the touchscreen state and the other the paramter state, i did have called them exactly the same, stupid..

          However it works now, thank you for the help!