home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OS2BAS.ZIP / MARKMOD.BAS < prev    next >
BASIC Source File  |  1989-08-13  |  2KB  |  59 lines

  1. '│*****************************************************************
  2. '│
  3. '│ Module:       MarkMod.bas
  4. '│
  5. '│ Subprograms:  DemoMark
  6. '│
  7. '│ Description:  DemoMark is passed two paramaters, the handle of the
  8. '│               presentation space, and the ID of the marker to use.
  9. '│               A graph of 20 random points is generated, proportional
  10. '│               to the current size of the Client window, plotting each
  11. '│               point with the marker specified by "marker%" which is
  12. '│               determined by the submenu item selected under GraphMarkers.
  13. '│
  14. '│*****************************************************************
  15. REM $INCLUDE: 'os2def.bi'
  16. REM $INCLUDE: 'pmbase.bi'
  17. REM $INCLUDE: 'gpiline.bi'
  18. REM $INCLUDE: 'gpicolor.bi'
  19. REM $INCLUDE: 'GPIMARK.BI'
  20.  
  21. COMMON /Gdemo/ cxClient%, cyClient%
  22.  
  23. SUB DemoMark(hps&, marker%)
  24. SHARED cxClient%, cyClient%
  25. DIM ptl(20) AS POINTL
  26.  
  27.   xincr% = cxClient% / 20     'Divide Client window by 20
  28.   RANDOMIZE TIMER             'Obtain seed for RND function
  29.   '│
  30.   '│ Generate 21 random Y corrdinate values and store points
  31.   '│ in ptl()
  32.   '│
  33.   FOR I% = 0 to 20
  34.     ptl(I%).x = I% * xincr%
  35.     ptl(I%).y = INT((cyClient% + 1) * RND)
  36.   NEXT I%
  37.   '│
  38.   '│ - GpiSetMarker selects the Marker from the default marker set to be used.
  39.   '│     marker% - 40 is need only because the value passed in marker%
  40.   '│     is actually the ID of the menuitem which happens to be 40 greater
  41.   '│     than the actual marker ID required by BpiSetMarker
  42.   '│
  43.   '│ - GpiMove postions graphics pointer to first point in graph
  44.   '│ - GpiPolyLine draws the graph from the points stored in ptl(), without
  45.   '│   markers
  46.   '│ - GpiSetColor changes color to RED to make the markers standout
  47.   '│ - GpiPolyMarker draws the selected marker at each point contained
  48.   '│   ptl()
  49.   '│
  50.   bool% = GpiSetMarker(hps&, marker%-40)
  51.   bool% = GpiMove(hps&, MakeLong(VARSEG(ptl(0)), VARPTR(ptl(0))))
  52.   bool% = GpiPolyLine(hps&, 20&, MakeLong(VARSEG(ptl(1)), VARPTR(ptl(1))))
  53.   bool% = GpiSetColor(hps&, CLRRED)
  54.   bool% = GpiPolyMarker(hps&, 19&, MakeLong(VARSEG(ptl(1)), VARPTR(ptl(1))))
  55.  
  56. END SUB
  57.  
  58.  
  59.