5 Replies
      Latest reply on Mar 8, 2019 1:16 AM by brinda.bhuptani
      brinda.bhuptani Level 1 Level 1 (0 points)

        I am working on Mac OS 10.13.

        In my application there are two windows. First window has NSSegmentedControl as IBOutletsand second window has programatically created NSSegmentedControl.

        When I set labels on NSSegmentedControl of second window, Labels of NSSegmentedControl outlets on First window becomes "…".

        See Image for reference below is sample code to load UI of second window.

         

        -(void)LoadGUI

        {

            NSRect window_frame =[[self window] frame];

            NSView *mainView = [[NSView alloc] initWithFrame:NSMakeRect(10,10,window_frame.size.width-10,

            window_frame.size.height-10)];

            NSSegmentedControl *segmentControl = [[NSSegmentedControl alloc] initWithFrame:NSMakeRect(150,150,109,30)];

         

            [segmentControl setSegmentCount:2 ];

            [segmentControl setLabel:@"Allowed" forSegment:0];

            [segmentControl setLabel:@"Deny" forSegment:1];

            [segmentControl setSegmentStyle:NSSegmentStyleAutomatic];

            [segmentControl sizeToFit];

            [segmentControl setTarget:self];

            [mainView addSubview:segmentControl];

            [self.window.contentView addSubview:mainView];

        }

         

        Note :

        1) This chunk of code does not work on Mac OS High Sierra only.

        2) If I comment "setLabel" for both segments, its works.


        Thanks