Status bar: how to detect touch events? [duplicate] - macos

This question already has an answer here:
Cocoa - Capturing NSStatusItem mouse hover event
(1 answer)
Closed 8 years ago.
I've successfully added a NSStatusItem to the menu bar, showing an regular NSMenu.
Is it possible to capture a hover event on this and in that case, display a different menu?

You need to create a new custom view, override method [NSView mouseEntered:] with [NSView addTrackingRect:...] and then set to the status item [NSStatusItem setView:]

Related

How to change background color status bar in Xamarine? [duplicate]

This question already has answers here:
Xamarin.Forms - Change StatusBar Color
(10 answers)
Closed last year.
I have seen many app they have a background image that goes up to the very top of the phone. I've been trying to achieve that on my xamarine project, but still not working. The navigation bar is still show the blue background color ..etc
How can I change the background of the navigation bar and also the very top bar which has the time and battery and wifi? I would like to change whole background color of the app.
Android:
Set the code below in OnCreate method of MainActivity:
this.Window.AddFlags(WindowManagerFlags.Fullscreen);
iOS:
Add the values into Info.plist(right click the file to view code).
<key>UIStatusBarHidden</key>
<true/>
Or you could double click the file to select the Hide status bar.

How to drag a window by dragging its content area, similarly to dragging the title area [duplicate]

This question already has answers here:
Move a NSWindow by dragging a NSView
(6 answers)
Closed 1 year ago.
My macOS app's NSWindow has a bottom status area that has no interactive parts. I would like the user to be able to drag the entire window by dragging that status area with the mouse, just like the user can drag the window by its title area.
How do I accomplish that in a clean way?
I expect that I should be able to forward the drag operation of the status area's NSView to the code that handles dragging the entire window somehow.
Using NSWindow.isMovableByWindowBackground or call NSWindow.performDrag(with: NSEvent) from within your NSView.
ObjC example:
-(void)mouseDragged:(NSEvent *)event {
[self.window performWindowDragWithEvent:event];
}

Disable default keyboard in compact framework [duplicate]

This question already has an answer here:
How to add image icon to title bar and hide bottom bar in Compact Framework.?
(1 answer)
Closed 7 years ago.
I have my own custom keyboard. So I don't want this bottom bar to be present on my screen. PFA. How to disable the default keyboard..
I have seen the same question using the same screen shot last week.
You need to set the form's main menu to null then there will be no menu bar with a SIP symbol inside.
DUPLICATE with How to add image icon to title bar and hide bottom bar in Compact Framework.?

NSTableView - select row and respond to mouse events immediately [duplicate]

This question already has answers here:
Respond to mouse events in text field in view-based table view
(6 answers)
Closed 9 years ago.
I have a view based NSTableView in which the cells contain a number of controls including text fields and edit fields. When a user tries to click on a control within a cell in order to, for example, start editing a text field, the click's main objective is ignored and the cell gets selected. Another click is then needed to perform the action originally intended, and even this click is subject to a delay before it's taken into account.
How can I avoid this problem and have the row selected and the mouse event forwarded to the control in one go?
I solved this issue by subclassing NSTableView:
#implementation QuickResponseTableView
- (BOOL)validateProposedFirstResponder:(NSResponder *)responder forEvent:(NSEvent *)event
{
// This allows the user to click on controls within a cell withough first having to select the cell row
return YES;
}
#end
Had the same problem. After much struggle, it magically worked when I selected None as against the default Regular (other option is Source List) for the Highlight option in IB! The accepted answer appears to be more specific but a little hacky compared to this.

SetHidden not working [duplicate]

This question already has answers here:
Cannot hide Controls in NSView
(2 answers)
Closed 9 years ago.
I am developing an application in cocoa.I need to hide a progress bar placed in an NSView
and show an NSTextfield in that place .I used the following cod
[progressbar setHidden:TRUE]
[textfield setHidden:FALSE];
But this code snippet is not working. Is that a bug.??I used to hide the same code to hide certain other text fields in the same page .But that controls became hidden.looking for a solution...
Are progressbar and textfield outlets ? If yes, make sure they are correctly connected in your nib. Also make sure that you call setHidden: from the main thread.
And unrelated to your problem, in Objective-C you should use YES instead of TRUE and NO instead of FALSE.

Resources