View previous topic :: View next topic |
Author |
Message |
rcsaumarez
Joined: 23 Mar 2008 Posts: 9 Location: Cambridge UK
|
Posted: Fri Dec 06, 2013 11:37 pm Post subject: Closing a drawing surface |
|
|
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. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8018 Location: Salford, UK
|
Posted: Sat Dec 07, 2013 9:03 am Post subject: |
|
|
I would need some sample code in order to understand what you are doing. |
|
Back to top |
|
|
rcsaumarez
Joined: 23 Mar 2008 Posts: 9 Location: Cambridge UK
|
Posted: Sat Dec 07, 2013 12:47 pm Post subject: |
|
|
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&',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 |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8018 Location: Salford, UK
|
Posted: Sat Dec 07, 2013 8:54 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
rcsaumarez
Joined: 23 Mar 2008 Posts: 9 Location: Cambridge UK
|
Posted: Sun Dec 08, 2013 12:35 pm Post subject: |
|
|
Great. Many thanks |
|
Back to top |
|
|
|