Loading ...
Sorry, an error occurred while loading the content.

40540Re: [libertybasic] Re: plot using EXCEL

Expand Messages
  • John Fisher
    Apr 2 6:45 AM
    • 0 Attachment
      Abouy the simplest I can go is the following. Are you looking at the
      Help files? Have you tried the supplied lessons?
      Do you know how to 'single step' through a program with the 'bug' icon
      next to the 'run' arrow icon?
      If so, try the following and try modifying it.
      Don't expect to do everything immediately!


      ' We don't need the text-only 'mainwin' but it may help debugging
      ' by allowing us to see values.
      nomainwin

      ' But we DO need a graphicbox #w.g in a 'Window' called #w.
      ' Choose size and position on your screen of this window (allow for
      scrollbars)
      ' Measurements all are referred to the top left.
      ' For the big window #w, it will be started 10 below & 10 to right of
      screen top-left.
      ' Its size will be 530 wide by 560 vertically, but this includes
      scrill bar/title/border.
      ' 10 dsideways & 10 down form this window top left corner we put a 500
      by 500 drawing area.

      UpperLeftX =10
      UpperLeftY =10

      WindowWidth = 530
      WindowHeight = 580

      ' Fit a 500 by 500 box to draw graphics with a nice border gap.
      ' The graphic area is 'addressed' (referred to) as #w.g, called its
      'handle'.
      ' The whole window has handle #w. #w.g is a 'child' of the main #w.
      graphicbox #w.g, 10, 10, 500, 500

      ' Open the window showing this empty graphicbox
      open "Example for Kurt of Simple Graph" for window as #w

      ' From here on, commands starting '#w, ....' or #w.g, ....' send
      commands to
      ' the full window, or to its graphic subwindow.

      ' Make sure clicking 'close' icon at top RH of #w exits cleanly.
      #w, "trapclose [quit]"

      ' Tell LB to put printing 'pen' down on page.
      ' Pen at this stage will be at ( 0, 0), at top LH of graphic area.
      #w.g, "down"

      ' Move to a position 100 sideways and 200 down, leaving a line.
      #w.g, "goto 100 200"

      ' Change color and size
      #w.g, "color red"
      #w.g, "size 4"

      ' Move to 200 sideways and 100 down, leaving no line.
      #w.g, "up ; goto 200 250 ; down"

      ' Lift pen, move to center-screen at 250, 250 and draw a colored circle.
      #w.g, "goto 250 250"
      #w.g, "color red ; backcolor cyan ; circlefilled 80"


      wait

      ' Come to here only if 'close' icon clicked.
      [quit]
      ' Shut the window
      close #w
      ' Tell LB the program has ended!
      end
    • Show all 22 messages in this topic