From 35ed8a21255090ab33af5a5186e1fc5a929cf3f8 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 23 Aug 2015 17:53:29 -0400 Subject: [PATCH] Fixed uiRadioButtons sizing problems. --- redo/reredo/darwin/radiobuttons.m | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/redo/reredo/darwin/radiobuttons.m b/redo/reredo/darwin/radiobuttons.m index 3eaf983e..a3b90fbb 100644 --- a/redo/reredo/darwin/radiobuttons.m +++ b/redo/reredo/darwin/radiobuttons.m @@ -19,13 +19,6 @@ static NSButtonCell *cellAt(uiRadioButtons *r, uintmax_t n) return (NSButtonCell *) [r->matrix cellAtRow:n column:0]; } -static void radioButtonsRelayout(uiDarwinControl *c) -{ - uiRadioButtons *r = uiRadioButtons(c); - - [r->matrix sizeToCells]; -} - void uiRadioButtonsAppend(uiRadioButtons *r, const char *text) { intmax_t prevSelection; @@ -37,8 +30,7 @@ void uiRadioButtonsAppend(uiRadioButtons *r, const char *text) [cellAt(r, [r->matrix numberOfRows] - 1) setTitle:toNSString(text)]; // this will definitely cause a resize in at least the vertical direction, even if not in the horizontal - // we do that when relaying out below - // TODO sometimes it doesn't work right + // DO NOT CALL sizeToCells! this will glitch out; see http://stackoverflow.com/questions/32162562/dynamically-adding-cells-to-a-nsmatrix-laid-out-with-auto-layout-has-weird-effec // and renew the previous selection // we need to turn on allowing empty selection for this to work properly on the initial state @@ -79,7 +71,6 @@ uiRadioButtons *uiNewRadioButtons(void) [r->matrix setAutosizesCells:YES]; uiDarwinFinishNewControl(r, uiRadioButtons); - uiDarwinControl(r)->Relayout = radioButtonsRelayout; return r; }