Announcement

Collapse
No announcement yet.

Colored lines go black - text vanishes - but program still runs?

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

  • Colored lines go black - text vanishes - but program still runs?

    Can't post code here.... too much

    My program has over 6000 lines now and uses some very large arrays. (HUGE!)

    This program does market charts and studies (indicators) with colored price bars and lines.

    Sometimes the program becomes slow and all the lines go black. (Not in a place where there would be a programming bug. It's as if some part of memory is corrupt, but the program is still running with all the numeric arrays intact!)

    However, the colors are still there and defined. The arrays are still intact. All the studies work, but no color. Just black on white!

    There is no text on the screen when it happens, but the program continues to run.

    The weirdest part!!! Graphic Box works. The boxes all have black borders, but they are filled with the colors (the same ones used in the Graphic Line commands).

    The black text still works, it's just the colored text that vanishes.
    Last edited by Doug Ingram; 31 Aug 2009, 12:34 AM.

  • #2
    Got to be a memory overwrite fault doesn't it?
    [I]I made a coding error once - but fortunately I fixed it before anyone noticed[/I]
    Kerry Farmer

    Comment


    • #3
      I don't know - because the program is still running with all arrays and data intact.

      Comment


      • #4
        Without seeing the code, we can't help too much. There might be an assignment that is wrong is some rarely used section.
        Rod
        I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

        Comment


        • #5
          Doug,
          are you allocating lots of handles and not freeing them? Font handles, window handles, bitmap handles, any handles.
          Check that everytime you allocate something that you don't forget to unallocate it.

          Paul.

          Comment


          • #6
            are you allocating lots of handles and not freeing them? Font handles, window handles, bitmap handles, any handles
            Using PB/CC? I think you only do that using the GRAPHICS statements, but since "code not shown" we have no clue if he's talking about 'regular' console output (LOCATE, COLOR, PRINT, etc) or GRAPHICS output.
            Michael Mattias
            Tal Systems Inc. (retired)
            Racine WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              Michael,
              yes, using PBCC. That compiler can still create windows and fonts and SDK code and the like.
              I recall having similar problems with corrupt graphics when incorrectly using handles. I think it was for pens used to draw lines where I abandoned the pen instead of restoring the old handle when I was finished with it.

              Paul.

              Comment


              • #8
                ...compiler can still create windows and fonts and SDK code and the like.
                Darned, silly me.

                That must be in the part of the code which is not shown.
                Michael Mattias
                Tal Systems Inc. (retired)
                Racine WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  I'll check into the pens and handles.

                  It would next to useless to post a 6,300 line program here.

                  It's also not in some obscure part of the program, but rather in its normal function.

                  The program could run hundreds of studies and markets and pan through the data and then have this occur. I was wondering only if such a thing had happened to others.


                  I only set one window and then clear and reuse it for each study.

                  This is done once...
                  -----
                  Local hWin As Dword

                  GRAPHIC WINDOW "Strategic Technical Initiatives - Predictive Path Analytics", wx0,wy0,wsizex,wsizey TO hWin 'x pos y pos x size y size
                  Graphic Attach hWin, 0,ReDraw
                  ----
                  I use Graphic Clear or fill a Graphic Box to clear all or part of the window.


                  I use this to change the title
                  ----
                  SetWindowText(hWin, "(c)2009 Strategic Technical Initiatives - Predictive Path Analytics | Select Data F1-F12 [F"+Trim$(Str$(datat(0)))+"] "+a$+market$+" | "+b$)
                  ----



                  I use this throughout the program with sizes from 8 to 16, but only this one font.
                  ----
                  Graphic Font "Courier New", 8, 1
                  ----



                  The only time I am not simply drawing a line or box (or printing text) is this - which works as expected to simply move the cursor without repainting the screen.
                  ----
                  Graphic Font "Courier New",8, 1
                  GRAPHIC STYLE 2:GRAPHIC WIDTH 1
                  IF iyprintold THEN
                  GRAPHIC SET MIX %MIX_NOTXORSRC'undraw old cursor
                  Graphic Line (wx1,iyprintold)-(wsizex,iyprintold) ,RGB(211,11,11)
                  Graphic Line (ixprintold,wy0)-(ixprintold,wline1-1),RGB(211,11,11)
                  'Graphic Set Pos (wsizex-120,iyprintold-14):Graphic Print Using$("#####.##",ypriceold);
                  GRAPHIC SET MIX %MIX_COPYSRC
                  END IF
                  GRAPHIC SET MIX %MIX_NOTXORSRC'draw new cursor
                  Graphic Line (wx1,iyprint)-(wsizex,iyprint),RGB(211,11,11) :iyprintold=iyprint:ypriceold=yprice
                  ixloc=ixleft+(ixprint-ix1)*ixs 'find x axis
                  Graphic Line (ixloc,wy0)-(ixloc,wline1-1),RGB(211,11,11) :ixprintold=ixloc
                  GRAPHIC SET MIX %MIX_COPYSRC
                  Graphic Font "Courier New", 11, 1
                  ----

                  Other than that - no major bells and whistles - just major league number crunching of huge arrays.

                  Comment


                  • #10
                    Compiler version not specified but...
                    GRAPHIC FONT has been superceded by the GRAPHIC SET FONT statement, although GRAPHIC FONT remains supported for a limited period. Existing code should be converted to the new syntax as soon as possible.
                    GRAPHIC SET FONT is "NEW!" in 5x/9x

                    While I don't know how GRAPHIC FONT works internally, these GRAPHIC FONT statements look like a good potential source of your problem, especially if these statements are executed many times.

                    You can write yourself a little test program easily enough: Put the posted code* into a loop and run it as many times as it might execute in your program. If this is the source of the problem, you should get the same behavior; and finding the problem is more than halfway to the solution.


                    MCM
                    * please use Code Tags when posting code.
                    Michael Mattias
                    Tal Systems Inc. (retired)
                    Racine WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      I'll try that. It looks like I was using the set font and then reverted to the latter for simplicity.

                      Thanks!

                      Comment


                      • #12
                        Originally posted by Michael Mattias View Post
                        Compiler version not specified but...

                        GRAPHIC SET FONT is "NEW!" in 5x/9x

                        While I don't know how GRAPHIC FONT works internally, these GRAPHIC FONT statements look like a good potential source of your problem, especially if these statements are executed many times.

                        You can write yourself a little test program easily enough: Put the posted code* into a loop and run it as many times as it might execute in your program. If this is the source of the problem, you should get the same behavior; and finding the problem is more than halfway to the solution.


                        MCM
                        * please use Code Tags when posting code.


                        Michael was absolutely right. The program has yet to "bomb" :breakpc:
                        again after converting all the graphic font statements (which were working!!!)
                        to Graphic Set Font. Looks like Graphics Font (alone) is not supported fully
                        even for the "limited time".

                        Comment


                        • #13
                          Looks like Graphics Font (alone) is not supported fully even for the "limited time".
                          I would not say that. Did you try "making bad things happen [using GRAPHIC FONT]?"

                          If the bad thing happened, it just meant that the "reuse the font by handle" offered by GRAPHIC SET FONT was what you needed; and that GRAPHIC FONT was lacking a suitable "Restrictions/Limitations" in its documentation, eg, "There ain't no release, so use sparingly!"

                          There's ALWAYS something you discover "the first time" you run something for real. Eg I'm doing a statement program right now, and sure as heck, the first time I ran against the production database, I found a customer with a balance due ("create a statement") but no "bill to address" (and send it..????). Oops, no statement created.

                          (I changed the database select to get me the row anyway).

                          MCM
                          Michael Mattias
                          Tal Systems Inc. (retired)
                          Racine WI USA
                          [email protected]
                          http://www.talsystems.com

                          Comment

                          Working...
                          X