Erase BOX, ELLIPSE, SHOW drawn directly on Window

Hi,

I have a panel which I use BOX, ELLIPSE and SHOW commands to draw some geometry on the fly.

How do I erase what I have drawn and start with a fresh empty panel? User enters box extent in a field, I want to draw the new extent but don’t want to see the prior lines/boxes.

I tried erase(?panel1). It did not erase the lines.

Is there something simpler than destroy and create the panel on each draw?

Thanks!

drawHole ROUTINE
erase (?panel1)

SETPENWIDTH ( 4 )
box (xOffset, yOffset, hx* 2 ,hy* 2 )

I just realized that the “owner” of the box is the window and not ?panel1. The boxes are drawn over ?panel1 but I don’t think that matters.

If I use erase() it wipes out the fields used to draw the box.

Anything less brutal than erase() to just delete the prior box/ellipse commands?

Use CREATE(, Create:Box) so they are Window controls and you can DESTROY.

It can be handy to have a BOX control that is HIDE and close to what you want so you can CLONE() then configure and unhide.

Help says ERASE " erases data from controls in the window and clears their corresponding USE variables " so nothing to do with graphics.

Maybe draw a BOX the size of the Panel using Fill Color:Btnface i.e. a gray rectangle ?

BLANK is the command you’re looking for

3 Likes

My mind drew a blank :frowning: … and went looking for the “Graphics” chapter in the help to find all those commands. That may have been a separate chapter in C4 or Cw20. I just found it in the help under topic “Functions by Type of Usage” … and in my C5 LRM.

Graphics Processing

  • ARC (draw an arc of an ellipse)
  • BLANK (erase graphics)
  • BOX (draw a rectangle)
  • CHORD (draw a section of an ellipse)
  • ELLIPSE (draw an ellipse)
  • IMAGE (draw a graphic image)
  • LINE (draw a straight line)
  • PENCOLOR (return line draw color)
  • PENSTYLE (return line draw style)
  • PENWIDTH (return line draw thickness)
  • PIE (draw a pie chart)
  • POLYGON (draw a multi-sided figure)
  • ROUNDBOX (draw a box with round corners)
  • SETPENCOLOR (set line draw color)
  • SETPENSTYLE (set line draw style)
  • SETPENWIDTH (set line draw thickness)
  • SHOW (write to screen)
  • TYPE (write string to screen)

Thanks!

  • BLANK (erase graphics)

Even says erase in the description for blank. So close.

I was looking at help for BOX. It has no reference back to the graphics section that I could find on the page. Now I know with your and Carl’s help. Thanks again.