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

Re: [libertybasic] Re: Flush and Stuff

Expand Messages
  • AW
    At 03:14 PM 7/2/02 -0000, you wrote: #main, delsegment cir Okay, what does LB see when it
    Message 1 of 5 , Jul 2, 2002
    • 0 Attachment
      At 03:14 PM 7/2/02 -0000, you wrote:

      <<It's as though the "delsegment" doesn't delete the segment.>>

      #main, "delsegment cir"

      Okay, what does LB see when it reads this command? Remember, "cir" is a
      variable and must be placed outside of the quote marks. Inside the quote
      marks it is just a string. It may be confusing because to GET the seg ID,
      you may place the desired variable name inside of the quotes, but that is
      JUST to FILL the variable.

      #main, "segment cir"

      The line of code above places the segID into the var "cir". This next line
      does nothing:
      #main, "delsegment cir"

      It does nothing because the string "cir" means nothing to LB. Instead:

      #main, "delsegment ";cir


      From the helpfile on graphics commands:
      ****************************************
      Using variables in commands:
      To use literal values, place them inside of the quote marks:

      print #handle, "box 12 57"

      To use variables, place them outside of the quote marks, preserving spaces:

      x=12 : y = 57
      print #handle, "box ";x;" ";y

      For more, see Undestanding Syntax.
      ****************************************

      Regards,
      Alyce





      .
    • lazman2001
      I m still not understanding why this won t work. It s never deleting the first segment. The first segment has the background and the extra bmp in it. If you
      Message 2 of 5 , Jul 2, 2002
      • 0 Attachment
        I'm still not understanding why this won't work. It's never deleting
        the first segment. The first segment has the background and the extra
        bmp in it. If you drag the window off the bottom of the screen a bit
        then bring it back up the background itsn't redrawn. It has the same
        effect if you cover the window up then click on it. If you don't move
        the window off the screen or cover it up it will work great.

        I'm using two bmps from the liberty basic folder so it should run
        from the editor without any changes.

        .:CODE:.

        loadbmp "bmp1", "bmp\button07.bmp"
        loadbmp "bmp2", "bmp\button08.bmp"

        open "Test" for graphics_nsb as #main
        #main, "trapclose [quit]"
        #main, "when leftButtonDown [clicked]"
        #main, "down; fill lightgray"

        'place an extra bmp on the screen
        #main, "place 50 50"
        #main, "drawbmp bmp1"
        #main, "segment segid"
        #main, "flush"

        'this bmp will be changed
        #main, "place 10 10"
        #main, "drawbmp bmp1"
        #main, "segment b1"
        #main, "flush"

        print "segid = ";segid
        print "b1 =";b1
        wait

        [clicked]
        if down = 0 then 'replace bmp1 with bmp2 and flush (check)
        print "segment number ";b1;" being deleted"
        #main, "delsegment ";b1
        #main, "place 10 10"
        #main, "drawbmp bmp2"
        #main, "segment b2"
        #main, "flush"
        #main, "redraw"
        down = 1

        else 'delete the drawing of bmp2 and redraw *note (X)
        print "segment number ";b2;" being deleted"
        #main, "delsegment ";b2
        #main, "place 10 10"
        #main, "drawbmp bmp1"
        #main, "segment b1"
        #main, "flush"
        #main, "redraw"
        down = 0
        end if

        wait


        [quit]
        unloadbmp "bmp1"
        unloadbmp "bmp2"
        close #main
        end
      Your message has been successfully submitted and would be delivered to recipients shortly.