Direct calls to SIMPLEPLOT

In this section:

For 32-bit applications, as an alternative to the automatic mode described above, %pl (SIMPLEPLOT Graphics Region) can take the form:

winio@('%pl[user_drawn]',width,height)

width and height give the pixel dimensions of a SIMPLEPLOT graphics region. There are no other arguments to go with %pl. Direct calls can be made to the SIMPLEPLOT library from within a %sc (OnShow Callback) call-back. Alternatively you could use %lw (Leave Window Open) and put the library calls after the set of winio@ statements that describe the window.

Here is a simple example that illustrates this approach. Another direct approach using %dw (Owner Draw Graphics) is illustrated here.

c--Simple3.for
      WINAPP
      INTEGER winio@,i,StartCB
      EXTERNAL StartCB
      i=winio@('%sy[no_border]%ca[User drawn]&')
      i=winio@('%pl[user_drawn]&',400,300)
      i=winio@('%sc',StartCB)
      END
c--The start-up callback
      INTEGER FUNCTION StartCB()
      INCLUDE 'CLEARWIN.INS'
      INTEGER N,i
      PARAMETER(N=101)
      REAL x(N),y(N)
c--Create the data.
      DO i=1,N
        x(i)=i-1
        y(i)=x(i)**2
      ENDDO
c--Call SIMPLEPLOT routines to plot the graph.
      CALL INITSP
      CALL PAGE(12.0,10.0)
      CALL CHSET(-11)
      CALL NEWPAG
      CALL TITLE7('Higher','Centre','Sample')
      CALL SCALES(0.0,10.0,1,0.0,100.0,1)
      CALL AXGRID('*Cartesian',1,-1)
      CALL NEWPIC
      CALL AXIS7('XCartesian','x-axis')
      CALL AXIS7('YCartesian','y-axis')
      CALL BRKNCV(x,y,N,-1)
      CALL SIMPLEPLOT_REDRAW@
      StartCB=1
      END

When you link this program you must link with simple.dll.

Notice that this window cannot be re-sized. As a result the x and y arrays for the data can be local to the start-up call-back function. Further information about the SIMPLEPLOT routines that are used in this example can be found in the documentation provided by BUSS Ltd.

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited