Silverfrost Forums

Welcome to our forums

Closing a drawing surface

6 Dec 2013 10:37 #13414

I use a drawing surface created with %gr. The problem is that when the program closes, the sutface is still there on top and I can't understand how to get rid of it. I can use the ecscape option in creating the surface, but for my application I would rather it simply disappeared on a mouse click.

7 Dec 2013 8:03 #13416

I would need some sample code in order to understand what you are doing.

7 Dec 2013 11:47 #13419

Thanks, here is some specimen code WINAPP program test1 include <windows.ins> call graphics_set(1) !Use naked surface call draw_filled_rectangle@(100,200,300,400,rgb@(0,250,250)) !\($$\)
!\($$\) . Tons of code here !\($$\) . Multiple redrawing on the graphics surface !\($$\) . !\($$\)
call menbut(ix_pos,iy_pos,ibutton) ! calls a mouse button handler to end program !\($$\) ? here to get rid of the graphics surface? end program test1

  subroutine L4_graphics_set(screen_type)
  integer cntrl,screen_type,handle
  external mouse_stat 
  include <windows.ins>

! Set up the Clearwin variables If(screen_type == 1) then i=winio@('%ww[naked]%es&' )
else i=winio@('%ww[no_border]&' ) i=winio@('%ww[]&')
i=winio@('%ca[Fractionation Trial]&') endif i=winio@('%`^gr[black,rgb_colours,full_mouse_input]&',1920L,1080L,handle,mouse_stat)

  i=winio@('%`cu&amp;',CURSOR_ARROW)
  i=winio@('%lw',cntrl) 
  end subroutine L4_graphics_set      
  
  integer function mouse_stat()
 ! use button_var   ! This contains some control variables
  integer flags,ix,iy
  include <windows.ins>
  flags=clearwin_info@('graphics_mouse_flags')   
  ix=clearwin_info@('graphics_mouse_x')
  iy=clearwin_info@('graphics_mouse_y')
  zmouse_but=flags                    
  zmouse_x=ix
  zmouse_y=iy
  mouse_stat=1
  end function mouse_stat
7 Dec 2013 7:54 #13420

If you make the control variable cntrl global (in COMMON or a MODULE) then setting it to zero and calling window_update@(cntrl) will close its window.

8 Dec 2013 11:35 #13425

Great. Many thanks

Please login to reply.