Re: Gotta Have It Programming Contest #1

new topic     » goto parent     » topic index » view thread      » older message » newer message
mattlewis said...
procedure win_click( atom this, atom event_type, atom id, atom event ) 
... 
end procedure 
set_event_handler( win, -1, wxEVT_LEFT_DOWN, routine_id("win_click")) 
 
wxMain( frame ) 

win_click() should be:

procedure win_click( atom this, atom event_type, atom id, atom event )  
	sequence triangle = xy_to_triangle( mouse_event_position( event ) )  
	if mouse_event_shiftdown( event ) then  
		integer ix = find( triangle, selection )  
		if ix then  
			selection = remove( selection, ix )  
		else  
			selection = append( selection, triangle )  
		end if  
	else  
		selection = { triangle }  
	end if  
	draw_triangles()  
	refresh_window( win )  
end procedure  

The extra code was causing a shift-clicked selected triangle to not be unselected.

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu