Window title bar width changes when maximized - windows

I created a demo app in Delphi 11.1 and when I maximize the window, the title bar width gets re-sized (squeezed). Is this the windows' default behavior? How do I prevent it? I just wanted to keep the same title bar width even after the window is maximized.
Window not maximized:
Window maximized and title bar width is automatically reduced!!

Related

PySide6 tray icon's menu background color disappears in macOS Monterey

I have a small PySide6 app and I created a Tray icon. When the icon is clicked I show a menu where one of the menu option's background is set to red:
self.context_menu = QtWidgets.QMenu()
trayMenu = QLabel("Test Menu")
trayMenu.setAlignment(QtGui.Qt.AlignCenter)
trayMenu.setStyleSheet("background:red;color:white;font-weight:bold;")
trayMenu.setMinimumSize(width, height)
trayMenu.setMaximumSize(width, height)
trayAction = QWidgetAction(self)
trayAction.setText("Test Menu")
trayAction.setDefaultWidget(trayMenu)
self.context_menu.addAction(trayAction)
self.tray_icon = QSystemTrayIcon()
self.tray_icon.setIcon(icon)
self.tray_icon.setContextMenu(self.context_menu)
The problem is when the menu appears I can see the background color as red for like 50ms so it just flashes a little bit of red background and the background color changes back to the original macOS menu background, while the label is bold and white as per the provided css. The same code works perfectly on Windows.
Using background-color:red; has the same effect.
Any idea what I can try?

Delay hiding automatic scroll bar in Mac OS

Is there a way to adjust the delay time for hiding the automatically appearing scroll bar in Mac OS?
Currently, after scrolling a page, the scroll bar appears for less than a second before disappearing. If you are trying to grab the bar to manually adjust scroll position, that isn't a lot of time.
Is there some sort of terminal command that can double the length of the delay before the scroll bar hides again?

Remove the baseline border of NSWindow title bar

Is there a way to remove the baseline border of the NSWindow title bar without subclass
the window and implement a title bar view myself? (traffic lights button is real tricky)
I wanted to make view and put it just under the window's title bar without the baseline
border so that the my view below will appear to be "stick" or "continued" from the
title bar, that is, if I made my view the same color as the title bar.
You can achieve that by:
window?.toolbar?.showsBaselineSeparator = false

Docking a borderless window with cocoa

I want to "dock" a rectangular bar immediately below the menu bar. It was quite easy to use -NSMakeRect() with the appropriate screen width from [[NSScreen mainScreen] frame] and then I set my window style via:
[window setStyleMask:NSBorderlessWindowMask];
which works fine. I try to possition my window as high as possible via:
[window setFrameOrigin:NSMakePoint(0.0f, screenrect.size.height];
which almost works. What I see is that there is a gap between my window and the system menu bar that is exactly the height of the title bar of my window if it was displayed. I cannot push my window any higher.
Is it possible to position a borderless window immediately below the menu?

Change color of title bar in cocoa

This must have been asked before, but after Googling I still can't find the answer.
How do you change the color of the title bar (The bar that you can click and drag around with the close, minimize and maximize buttons) to a different color than the default gray in Cocoa?
If you set the background color of a "textured" window (a distinction that isn't really all that visible in Snow Leopard) that color will be applied to the titlebar as well. This is what Firefox does.
I would recommend though not having a real titlebar (i.e. setting your window to have no titlebar) and using +[NSWindow standardWindowButton:forStyleMask:] and putting your own buttons in the "titlebar". This allows you more control and is way way less hacky.
If it's a panel, you can change it to black by instantiating it as a HUD window.
Otherwise, you can't. Ever notice how there aren't any Aqua windows with different-colored title bars roaming around in other apps? This is why.
The only other way to change the appearance of the title bar (without relying on private implementation details such as the existence of a frame view) is to make the window borderless and create its title bar and window buttons from the ground up.
If you go with Colin's approach of making the window textured in interface builder (check box in the attributes of the window), here's the line to change the background color of the window you'd put in this function of the appDelegate.m file
//In this function --->
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
//type this
[_window setBackgroundColor: NSColor.whiteColor];
If you don't mind private API, you could subclass NSThemeFrame.
Setting title bar appears as transparent
self.window.titlebarAppearsTransparent = YES;
And setting window background color as you wish

Resources