简体   繁体   中英

Programmatically select a cell in NSMatrix automatically makes the cell visible

I've been working with some legacy codes, and the current situation is I have a NSMatrix as a group of radio buttons inside a NSScrollView. The NSMatrix is at the top of the NSScrollView, and the NSScrollView can contain up to hundreds of other subviews.

Every time when the function -(void)selectCellAtRow:(NSInteger)row column:(NSInteger)column is used to programmatically select a radio button in the NSMatrix, the NSScrollView will automatically scroll up so that the selected radio button will be visible. Some customers find it very annoying.

Is it a default behavior of that function? How do I stop this automatic scrolling?

Related, but not the same, question: Selecting Item of NSMatrix programatically

selectCellAtRow:column: triggers scrollCellToVisibleAtRow:column: . Subclass NSMatrix , override

- (void)scrollCellToVisibleAtRow:(NSInteger)row column:(NSInteger)col;

and don't call super (if the matrix is invisible).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM