Announcement

Collapse
No announcement yet.

Error 21

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

  • Error 21

    Hi,
    I have just tried to load a simple program in my GFX 32, compiling is ok but program give me Error 21 on startup. Source code:
    Code:
    #platform "uLCD-32PT_GFX2"#inherit "4DGL_16bitColours.fnc"#inherit "VisualConst.inc"#inherit "Essais 1Const.inc"#inherit "LedDigitsDisplay.INC"func main()//  Uncomment the following if uSD images used.putstr("Mounting...\n");    if (!(disk:=file_Mount()))        while(!(disk :=file_Mount()))            putstr("Drive not mounted...");            pause(200);            gfx_Cls();            pause(200);        wend    endif    gfx_TransparentColour(0x0020);    gfx_Transparency(ON);// Form2 generated 30/01/2012 23:08:55hndl := file_LoadImageControl("ESSAIS~1.dat", "ESSAIS~1.gci", 1);repeat        img_Show(hndl,iForm1) ;gfx_Set(SCREEN_MODE,LANDSCAPE) ;// TempDigit generated 30/01/2012 22:30:38        img_Show(hndl, iTempDigit);  // show all digits at 0, only do this once        gfx_Set(4, 0);        gfx_Set(TRANSPARENT_COLOUR, 0);// TempDigit generated 30/01/2012 22:35:45        img_Show(hndl, iTempDigit);  // show all digits at 0, only do this once        ledDigitsDisplay(0, iTempDigit, 104, 4, 0, 30, 0 ) ;    foreverendfunc
    I have copied GCI and DAT files to micro SD (Fat16 formated).
    Any idea why?

  • #2


    From the manual (appendix B) error 21 is "Bad txt_Set(...) command number", which I guess includes gfx_Set.



    From your program I see



    gfx_Set(4,0);



    Unfortunately, the manual documents 4 as being the value for TRANSPARENT_COLOUR, however, this is an error in the manual, 4 is not valid and is what is causing the error 21. You should use the predefined name.
    Mark

    Comment


    • #3


      Indeed, that was the issue. Next question: why the compiler did not complain?

      Comment


      • #4


        'cause it's just a compiler.



        If you call a windows function with an invalid parameter does the compiler complain? Of course not, you get a run time error.
        Mark

        Comment

        Working...
        X