You can use the CLIPPED flag or check_view().
When using the latter you could also have a look at this thread: http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=350775#Post350775