forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Closing a drawing surface

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
rcsaumarez



Joined: 23 Mar 2008
Posts: 9
Location: Cambridge UK

PostPosted: Fri Dec 06, 2013 11:37 pm    Post subject: Closing a drawing surface Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7912
Location: Salford, UK

PostPosted: Sat Dec 07, 2013 9:03 am    Post subject: Reply with quote

I would need some sample code in order to understand what you are doing.
Back to top
View user's profile Send private message AIM Address
rcsaumarez



Joined: 23 Mar 2008
Posts: 9
Location: Cambridge UK

PostPosted: Sat Dec 07, 2013 12:47 pm    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7912
Location: Salford, UK

PostPosted: Sat Dec 07, 2013 8:54 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
rcsaumarez



Joined: 23 Mar 2008
Posts: 9
Location: Cambridge UK

PostPosted: Sun Dec 08, 2013 12:35 pm    Post subject: Reply with quote

Great. Many thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group