Hi there, Not sure how much I can help, but I do have some different predicate rows that seem to work for me:
class StepperRowTemplate : NSPredicateEditorRowTemplate { override var templateViews: [NSView] { get { let XVPredicateRowStepperOffset = CGFloat(8) var views = super.templateViews (views.last! as! NSTextField).alignment = .right var frame = views.last!.frame frame.origin.x = frame.origin.x + frame.size.width + XVPredicateRowStepperOffset let stepper = NSStepper(frame: frame) stepper.minValue = 0 stepper.valueWraps = false stepper.bind(.value, to: views.last!, withKeyPath: #keyPath(NSTextField.doubleValue), options: [NSBindingOption.continuouslyUpdatesValue:true]) views.append(stepper) return views } } } class DatePickerRowTemplate : NSPredicateEditorRowTemplate { func newDateView() -> NSDatePicker? { let XVDatePickerWidth = CGFloat(150) let datePickerCell = NSDatePickerCell() var frame = super.templateViews.last!.frame frame.size.width = XVDatePickerWidth datePickerCell.calendar = Calendar(identifier: .gregorian) datePickerCell.datePickerMode = .single datePickerCell.datePickerElements = .yearMonth datePickerCell.dateValue = Date() datePickerCell.isEditable = true let datePicker = NSDatePicker(frame: frame) datePicker.cell = datePickerCell return datePicker } var dateView: NSDatePicker? override func copy(with zone: NSZone? = nil) -> Any { let newRow = super.copy(with: zone) as! DatePickerRowTemplate newRow.dateView = newDateView() if let _ = dateView { newRow.dateView!.dateValue = self.dateView!.dateValue } return newRow } override var templateViews: [NSView] { get { let views = super.templateViews let datePicker : NSDatePicker if let _ = dateView { datePicker = dateView! } else { datePicker = newDateView()! } return [views[0], views[1], datePicker] } } } That sort of thing worked for me. Regards, Arved > On 17 May 2025, at 05:00, cocoa-dev-requ...@lists.apple.com wrote: > > Send Cocoa-dev mailing list submissions to > cocoa-dev@lists.apple.com > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.apple.com/mailman/listinfo/cocoa-dev > or, via email, send a message with subject or body 'help' to > cocoa-dev-requ...@lists.apple.com > > You can reach the person managing the list at > cocoa-dev-ow...@lists.apple.com > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Cocoa-dev digest..." > > > Today's Topics: > > 1. NSPredicateEditorRowTemplate subviews layout (Dragan Mili?) > 2. NSPredicateEditorRowTemplate subviews layout (Dragan Mili?) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 16 May 2025 16:35:31 +0200 > From: Dragan Mili? <mi...@mac.com> > To: Cocoa-dev <cocoa-dev@lists.apple.com> > Subject: NSPredicateEditorRowTemplate subviews layout > Message-ID: <358a8e5c-fb06-4d7a-bf0b-e85ee652f...@mac.com> > Content-Type: text/plain; charset=utf-8 > > Hello everyone still here, > > I?d appreciate if anyone can tell me if there?s a way to actually control > visual layout of subviews in a predicate editor row template. I have a > predicate editor with custom row template subclasses, all created in code > (not in IB) and it all works fine, but the problem are template (sub)views, > which are not NSPopUpButton(s). > > As I select different items of popup buttons, effectively changing editor?s > predicate property, those buttons seem to get resized according to some > strange own logic, but the general the problem is that size (width) of > controls, such are text fields and date pickers, gets unpredictable and they > usually shrink, even though there is still a plenty of room in the template > row width. > > Trying to resize any control in a row template by force (setFrame: or > setFrameSize:) has no effect. > > I can show some screenshots and videos of the behaviour, as well as code > samples, if necessary, but I?d like to ask first, maybe someone already knows > what I?m talking about and provide some insights and solutions. > > Thanks in advance, > -- Dragan > > ------------------------------ > > Message: 2 > Date: Fri, 16 May 2025 16:36:01 +0200 > From: Dragan Mili? <mi...@mac.com> > To: Cocoa-dev <cocoa-dev@lists.apple.com> > Subject: NSPredicateEditorRowTemplate subviews layout > Message-ID: <87792e31-7d48-489a-95bb-50b756660...@mac.com> > Content-Type: text/plain; charset=utf-8 > > Hello everyone still here, > > I?d appreciate if anyone can tell me if there?s a way to actually control > visual layout of subviews in a predicate editor row template. I have a > predicate editor with custom row template subclasses, all created in code > (not in IB) and it all works fine, but the problem are template (sub)views, > which are not NSPopUpButton(s). > > As I select different items of popup buttons, effectively changing editor?s > predicate property, those buttons seem to get resized according to some > strange own logic, but the general the problem is that size (width) of > controls, such are text fields and date pickers, gets unpredictable and they > usually shrink, even though there is still a plenty of room in the template > row width. > > Trying to resize any control in a row template by force (setFrame: or > setFrameSize:) has no effect. > > I can show some screenshots and videos of the behaviour, as well as code > samples, if necessary, but I?d like to ask first, maybe someone already knows > what I?m talking about and provide some insights and solutions. > > Thanks in advance, > -- Dragan > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins (at) lists.apple.com > > https://lists.apple.com/mailman/listinfo/cocoa-dev > > > ------------------------------ > > End of Cocoa-dev Digest, Vol 22, Issue 12 > ***************************************** _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com