Announcement

Collapse
No announcement yet.

Graphic Scale

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

  • Graphic Scale

    During the conversion of a program in the new version 9, I have noticed that GRAPHIC SCALE (with coordinates that grow downward), turns upside-down the drawings if the custom world coordinates are equal to the client area of the graphic control (see the sample code below).
    I know that this setting is formally wrong because the client area limits go from 0 to the maximum size decreased of 1, but this behavior could perhaps create some problem to other users. This doesn't occur with the previous versions of the compiler.

    Code:
    #COMPILER PBWIN 9
    #COMPILE EXE
    #DIM ALL
    
    GLOBAL hDlg AS DWORD
    GLOBAL grfId AS LONG
    
    SUB DrawFrame()
    
      LOCAL hFnt, w, h  AS LONG
    
      CONTROL GET CLIENT hDlg, grfId TO w, h
      GRAPHIC ATTACH hDlg, grfId, REDRAW
      GRAPHIC CLEAR %WHITE
      GRAPHIC SCALE (0, h) - (w, 0)
      ' GRAPHIC SCALE (0, h-1) - (w-1, 0)  ' this works fine...
    
      FONT NEW "Arial",18, 1 TO hFnt
      GRAPHIC SET FONT hFnt
    
      GRAPHIC LINE (10, 10) - (w*0.9, 10), %RED
      GRAPHIC LINE (10, 10) - (10, h*0.9), %RED
      GRAPHIC LINE (10, 10) - (w*0.9, h*0.9), %BLUE
    
      GRAPHIC COLOR %BLACK, %WHITE
    
      GRAPHIC SET POS (10,h*0.9)
      GRAPHIC PRINT "UP"
    
      GRAPHIC REDRAW
    
    
    END SUB
    
    
    '------------------------------------------------------------------
    CALLBACK FUNCTION DlgProc () AS LONG
    
      SELECT CASE CB.MSG
        CASE %WM_INITDIALOG
        CASE %WM_COMMAND
          IF CB.CTLMSG = %BN_CLICKED THEN
            SELECT CASE CB.CTL
            CASE %IDCANCEL
              DIALOG END CB.HNDL
            END SELECT
          END IF
      END SELECT
    
    END FUNCTION
    
    
    
    '------------------------------------------------------------------
    FUNCTION PBMAIN () AS LONG
    
    
      LOCAL w, h AS LONG
    
      w = 500
      h = 500
    
      DIALOG NEW PIXELS, 0, "Graphic test",,, w, h, %WS_CAPTION OR %WS_SYSMENU, 0 TO hDlg
    
      CONTROL ADD GRAPHIC, hDlg, grfId, "", 0, 0, w, h
    
      DrawFrame
    
      DIALOG SHOW MODAL hDlg, CALL DlgProc
    
    END FUNCTION
    Any suggestions?

    bye

    Sergio

  • #2
    I know the GRAPHIC SCALE issue has already been reported as there was another thread on this some weeks past. http://www.powerbasic.com/support/pb...=GRAPHIC+SCALE
    Rick Angell

    Comment


    • #3
      Hi Richard,
      thank you for the reply; I had not looked for the solution in the forum because GRAPHIC SCALE had worked well in past release of the compiler.
      I have noticed that also Ari Savola goes crazy for understanding the source of the problem; maybe it would be necessary to report this behavior in the PowerBase section of the forum.

      bye

      Sergio

      Comment


      • #4
        maybe it would be necessary to report this behavior in the PowerBase section of the forum
        PB knows about the problem. You could write to [email protected] to express your opinion, but PB might not post on it. In this case the user is normally going to visually "see" the problem, look for a thread on it and seek an answer, if not found, by contacting PB at the mail address just given.
        Rick Angell

        Comment


        • #5
          Ok, many thanks for your explanations

          Cheers

          Sergio

          Comment

          Working...
          X