Announcement

Collapse
No announcement yet.

gfx_MoveRel doesn't seem to affect putnum()

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

  • gfx_MoveRel doesn't seem to affect putnum()

    I need to output a number as XX.X, so I did this:
    putnum( DEC2ZB, volts);
    putstr( ".");
    gfx_MoveRel(-15,0);
    putnum( DEC1Z, (millivolts + 50) / 100);
    The problem is that the gfx_MoveRel() seems to have no effect.
    It doesn't matter what I set the numbers to, the 2nd putnum() doesn't change origin.

  • #2


    Hi, to print text or numbers to a graphics origin, you need to over-ride the text row/column formatting.

    to(GFX); putnum( DEC1Z, (millivolts + 50) / 100);

    will print to the current graphics co-ordinate
    Regards,
    Dave

    Comment


    • #3


      That's interesting.
      I've found that gfx_MoveTo() works just fine with putstr() and putnum().
      It's just the gfx_MoveRel() that wasn't working.

      I'll try using the "to(GRX)" to see if that helps.

      Comment


      • #4


        I also see that the "GFX" argument for the "to()" function is completely undocumented.
        Not only is it undocumented, it's a syntax error if you try and use it.

        Comment


        • #5


          Please refer to
          http://www.4dsystems.com.au/developers/docs.php?cat=10&id=49
          Regards,
          Dave

          Comment


          • #6


            Ok, so it's documented online.
            Just the downloadable PDF docs don't have the GFX option.
            And using Workshop2, it's still a syntax error.

            I put
            to(GFX);
            in my code, and get
            undefined variable or function in line 905, column 10 (pass 2)

            (and it would have been easier to copy that msg in here if the "copy" item from the right-click popup menu actually worked on the message display area.)

            Comment


            • #7


              Ahh, re-reading the docs again, to() apparently ONLY works for the print() function.
              I'm using putnum().
              I'm guessing the compiler doesn't like the to() not being immediately followed by a print().

              Comment


              • #8


                oh ok sorry, didn't realize your using GFX2, so the to(GFX); command is deprecated for GFX2 as the text position is updated automatically by gfx_MoveTo(...); , however, as you have discovered - gfx_MoveRel(...); is not updating the text position but works fine for all other graphics. This has now been changed thanks to your report. The fix will be available in the next PmmC release. A temporary workaround would be to maintain your own relative co-ordinates and call gfx_MoveTo(...); to position the text.
                Regards,
                Dave

                Comment

                Working...
                X