Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!midway!midway!scott From: scott@sage.uchicago.edu (Scott Deerwester) Newsgroups: comp.sys.next Subject: Customizing a ScrolView Message-ID: Date: 2 Feb 91 19:48:21 GMT Sender: news@midway.uchicago.edu (News Administrator) Distribution: na Organization: /Users/scott/.organization Lines: 32 I wonder if anybody out there can help me with a problem. I'm trying to customize a ScrollView so that when I hit the mouse inside, it selects an entire line (something like the summary window of the Mail application) rather than characters within the line. So I wrote a class called Lines and overrode the - setSel method thus: - setSel:(int)start:(int)end { int newStart, newEnd; newStart = [self positionFromLine : [self lineFromPosition : start]]; newEnd = [self positionFromLine : [self lineFromPosition : end] + 1]; [super setSel : newStart : newEnd]; return self; } The problem is that it never gets called in response to the mouse. I've looked at it in gdb, and neither it nor the Text setSel method get called. My guess is that ScrollView has handed off mouseDown to the Text (Lines, in this case) delegate, which is probably the ClipView or something known to it, which is doing the selection itself. I can't figure out how the selection could be done without invoking the Text object's setSel method. It happily selects whatever characters I've moused, and never even invokes the above code. If I call the customized setSel method explicitly, it works just fine. Help! -- Scott Deerwester | Internet: scott@tira.uchicago.edu | ~{P;N,5B~} Center for Information and | Phone: 312-702-6948 | Language Studies | 1100 E. 57th, CILS | University of Chicago | Chicago, IL 60637 |