How to enable toolbaritems in NSToolbar? - cocoa

I have created an application in which I have implemented a custom toolbar, and I have put a custom item in that toolbar. But I am unable to click on it; it shows
that it's disabled. How to solve this problem?

If toolbar buttons are disabled by default and you haven't implemented NSToolbarItemValidation, it's usually because you have forgotten to connect the buttons to IBActions, or you have but you haven't implemented the actions.

Implement the NSToolbarItemValidation protocol in your NSToolbar's delegate, and return NO for every NSToolbarItem that you want disabled (return YES to enable it).

i had similar issue, and got resolved by subclassing NSToolbarItem and override validate Method in it.

NSToolbarItem are disabled by default if you do not implement the corresponding action on the target. Be sure to have a corresponding method for the action on the target instance.

In the Storyboard, select the tool bar item.
In the Utilities panel in the right side select Attributes inspector.
Turn off the Autovalidates option for Behaviour.

Related

Xamarin master detail page with static header and context menu

I need to do a master detail layout page in Xamarin which then will be used in child pages.
Please check the screenshot below:
I need to have a header part with button for notifications and a button for context menu plus a header.
What is the best approach how I can create this layout in Xamarin?
I will assume that you want to use Xamarin.Forms, instead of using Xamarin.Android and Xamarin.iOS separately.
One approach would be to use default MasterDetailPage as described here or even better to try it with Shell as described here.
Then, you would need to create your CustomNavigationPage and write a custom renderer for it.
Second approach would be to do some tricks, again creating your CustomNavigationPage with template(so that the navigation bar is always displayed) and that you change content dynamically.
Also, you would need to hide default navigation bar and attach click events to your menu button to really open up the menu.
Hope you got it clearly.
MasterDetailPage already provides nearly all functionality that you have asked for, so in some way your question isn't quite clear as you already mention MasterDetailPage. The only remaining problem I can see is how to set up a custom header, and that is than with NavigationPage.TitleView.

Eclipse Scout Neon hide settings icon on table field

I would like to know how to hide settings wheel icon in header of table field.
Note: At the time of writing, Eclipse Scout Neon is not yet released.
From browsing the source code I did not see a convenient getConfigured... method to quickly hide that menu.
Fear not, you have two options to do so anyway.
The menu you wish to get rid of is the OrganizeColumnsMenu.
Override execInitTable on your table and hide the menu:
getMenuByClass(OrganizeColumnsMenu.class).setVisibleGranted(false);
Alternatively, override addHeaderMenus(OrderedCollection<IMenu> menus) and either remove the menu added by the default implementation, or not call the super implementation at all.

KIF test failing - view is not enabled for interaction

Trying to run a KIF test. I want to tap the button with accessibility label "LOG IN" but it times out with the message "view is not enabled for interaction".
[tester tapViewWithAccessibilityLabel:#"SIGN IN"];
The button is there, and it has this text in its label. How do I "enable" this UI element?
FOR KIF: Another way to tell information for user interaction on views is to turn on the Accessibility Inspector within the iOS simulator. This will let you click on views and see if they're actually clickable/or blocked by other views inadvertently. It will also show you if the view has an accessibility label, trait (button, label, static text), and/or frame. Useful for checking your user interaction - ie. if it's static text or a button etc.
TO TURN ON ACCESSIBILITY INSPECTOR: Run your app, open the simulator--->click on the home button---->go to settings--->general--->accessibility--->toggle the accessibility inspector to ON--->run your app again or click on HOME button again, then click on your app.
You get this error message if isUserInteractionActuallyEnabled of a view yields NO. For example have a look at the definition of tapAccessibilityElement:inView: in KIFUITestActor.m. The method isUserInteractionActuallyEnabled is implemented in UIView-KIFAdditions.m and basically checks the property isUserInteractionEnabled of a view and does some more elaborate checks if you tap a button in a navigation bar or an action sheet.
You should try to set accessibilityLabel in Xcode's interface builder under the identity inspector at the user defined runtime attributes (with the key path set to "accessibilityLabel", type set to "String" and value set to "SIGN IN".
There are other ways to set accessibilityLabel like from code you can say:
[_buttonName setValue:#"SIGN IN" forKey:#"accessibilityLabel"];
I hope this one helped.

Is setting the custom class in IB not working in Xcode 4.5?

I have a button class named BFToggleButton, derived from UIButton. In my xib file, I dragged a UIButton, changed its custom class as BFToggleButton. In the Objects part of the IB, I'm seeing this button as Toggle Button - Button.
However, in the code, when I call a method that's not present in UIButton, but present in BFToggleButton class, I get an exception saying that an unrecognized selector is sent to an instance of UIButton.
So that gives me the impression that there may be a problem about setting the custom class in Xcode 4.5. Because if I'm not missing anything this should work according to my experiences with the previous XCodes.
Have you experienced the same thing?
Seems like the problem was about the Target Membership of the BFToggleButton class. I right clicked on this class and selected Show File Inspector and saw that the Target Membership checkbox was not checked and that was why the interface builder didn't recognize this class.

Custom NSTextView autocompletion menu

How would one implement a custom auto-complete pop-up menu like Xcode has?
At the moment I can only put custom auto-completions using
- (NSArray *)textView:theTextView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(int *)index
I want a bit more flexibility than this.
Cheers!
MT
Xcode (and other apps) use a custom auto-completion view. You can bring up your view at the correct location using the text view's layout manager's method locationForGlyphAtIndex: (which return an NSPoint).

Resources