PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7938 Location: Salford, UK
|
Posted: Sat Feb 11, 2006 1:54 am Post subject: Updating a format window |
|
|
Paul
Here is an example that might give you some ideas.
It displays a set of traffic lights. When you click on a light it changes colour.
winapp
c---------------------------------------------------------------
integer i,winio@
external fill_func,start_cb
i=winio@('%ww[no_maxminbox]&')
i=winio@('%mn[&Exit]&','EXIT')
i=winio@('%^gr[black,rgb_colours]&',100,250,fill_func)
i=winio@('%sc',start_cb)
end
c---------------------------------------------------------------
integer function start_cb()
include <clearwin.ins>
integer i,w
call set_line_width@(2)
w=RGB@(200,200,200)
call rectangle@(1,1,99,249,w)
do i=50,200,75
call ellipse@(50,i,32,32,w)
enddo
start_cb=1
end
c-------------------------------------------------------------
integer function fill_func()
include <clearwin.ins>
integer x,y,v,r,a,g,w
call get_mouse_info@(x,y,v)
call get_rgb_value@(x,y,v)
r=get_matched_colour@(RGB@(255,0,0))
g=get_matched_colour@(RGB@(0,255,0))
a=get_matched_colour@(RGB@(255,168,0))
w=get_matched_colour@(RGB@(200,200,200))
if(v.eq.0)then
call fill_surface@(x,y,v,r)
elseif(v.eq.r)then
call fill_surface@(x,y,v,a)
elseif(v.eq.a)then
call fill_surface@(x,y,v,g)
else
call fill_to_border@(x,y,0,w)
endif
fill_func=1
end |
|