Open window such that is shows on all desktops - objective-c

I have a screenshot thing, what it does is it takes a screenshot of the current visible stuff, then opens a full screen window covering everything. However this opens on the desktop of the parent window which is on desktop 1. And if a user had desktop 2 focused (due to like fullscreen app or something) then the window that opened will not show on desktop 2.
So I was wondering if there is a window level or something (I tried all the window levels) that will make it such that a window appears on all desktops.
Thanks

This sounds like either NSWindowCollectionBehaviorCanJoinAllSpaces or NSWindowCollectionBehaviorStationary. Set it as the collectionBehavior of the window.
(You probably want to set the window level, too, but that's about ordering rather than collection/Spaces behavior. And if you have a Window menu, then you probably also want NSWindowCollectionBehaviorIgnoresCycle.)

Related

Set focus to child window in PyGtk

I am writing a simple application in python using PyGObject and glade. The application has a main window and a functional window (Generate logs, also a Window object) which opens up on clicking a menu item.
The Generate logs window is supposed to:
Show options to generate log for a particular date
Be minimizable and should close automatically when the task is complete (OR)
Be able to be closed manually if the user wishes so
The problem is, once I show up the Generate logs window, I am directly able to select the main window as well. Then, I can go to the menu and bring up as many Generate logs windows as I want.
I have tried several options (Is Focus, setting up main window as Transient parent etc) but nothing worked. How can I fix this?
First you say PyGTK, then you say PyGObject, this are 2 different things. I'm going to answer for PyGTK (my sources are from GTK+ 2 docs) since it's in the title and maybe people looking for that will end up here. But never fear, because for this question, the answer is practically (I think exactly) the same for both.
What I understand is that you want you "Generate log" window to be modal. That means other windows can't be used while your modal window is up, just like a Dialog window. Also you should set the main window to be the parent of your modal window, since this helps the OS Window Manager i.e. keep the dialog on top of the main window.
Yo can do both of this things directly from Glade (if you've created both windows in the same project, not always the case) selecting the Modal atribute to True and the Transient for Window attribute to your main window, in the General Properties section of your Generate log window.
Also you can do it programmatically using the set_modal() and the set_transient_for(parent_window) method of your child window.
Let's say your parent window is called main_window and the child window is generate_log_window, then you can do it like this:
generate_log_window.set_modal(gtk.TRUE)
generate_log_window.set_transient_for(main_window)
If you want it to show center top of your main window, do this
generate_log_window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
To your second point, the ability to minimize can be set from Glade.
Sources:
GTK+ 2 GtkWindow reference set_modal
GTK+ 2 GtkWindow reference set_transient_for
PyGTK FAQ: How do I get my windows to show up where I want
PyGTK FAQ: How do I make a dialog block the whole application, so the user is forced to answer it?
create several windows (see your other post).
Upload them in init
Show them with "signals" in glade using "show" and "hide"
class GUIxxxx
#...
def action1(self, widget, data=None):
self.window1.show()
def action2(self, widget, data=None):
# do something here
self.window1.hide()

How To get to know focussed window in cocoa, and how to set it to desired window.?

I am new to the cocoa mac development, Right now i am developing a mac app having several server hit after a particular time. If the hit gets desired data then I need to to show the equivalent window and to show the window i am using [myWindow showWindow:self] method. It shows desired window and set the key window to my visible window is that myWindow.
Each and everything is fine till now but the problem is that suppose when a user start working on any window and open several other child window then unfortunately my show window get called and the focus of my working window transferred to other window.
After several searches i found that i can get the focused window by accessing the [[NSApplication sharedApplication]keyWindow]delegate], I applied several condition that when my this and this window is on key window then don't hit server.
But the problem is not get solved. Now i think setting a keyWindow to my current working window will be best option.
Please suggest me what can i do and how i can forcefully set a window as my key window.
Any Help would be appreciated.
Thanks In advance.
If I understand your question correctly you wish to bring a window forward if it receives input from your server but without moving it in front of the current main or key windows.
The method you are using, showWindow:, belongs to NSWindowController and both shows a window and makes it key.
What you need to look at are the NSWindow methods for managing the window levels, orderFront: et al.
In particular you might want to use orderWindow:relativeTo: which allows to place a window in front/behind another window. For example:
[<window> orderWindow:NSWindowBelow
relativeTo:NSApp.keyWindow.windowNumber];
will move a window to be immediately behind the current key window, and in front of any other windows behind the key window.
HTH

Hide window from taskbar vb.net and alt+tab via WindowHandle

I have the window handle of another application and I want to remove it from the windows taskbar. I'd also like to remove it from the alt-tab menu. The window is a chrome app running my webpage, and I've experimented and I can effect it with MoveWindow successfully.
I just need to know how to declare the APIs to do this, if it's possible and how please :D
Thank you StackExchange!!!
Since all this got is 1 measly downvote, I managed to create a work around. I simple set the window state to hide or show using its handle.

Windows 8 tablet - How to prevent explorer from starting desktop app with maximized window?

When I start a desktop application on Windows 8 tablet, Explorer starts it with SW_SHOWMAXIMIZED.
For example, if you start Notepad from command prompt, it opens in normal window size, but if you do that from Explorer, maximized window is opened. I have seen this Explorer behavior only on tablet PC and I guess Explorer is doing that on purpose.
I understand that it may be useful for many application programs, but I want my program to start with normal size unless user explicitly requests Explorer to open it maximized.
Is there a way to stop this for my application? I'm hoping that there is an API or manifest to do that, but I couldn't find any information at MSDN.
Thanks in advance.
See if this helps:
Open any program that is affected with this issue. Note: Make sure that it is the only open window of that program. eg. You can only do this if you have one window of command prompt open.
Adjust the window size and position to your liking.
While holding Ctrl on your keyboard, close the window by clicking (or touching, for tablet) the X in the top-right corner of the window to close it.
Re-open the program. Your window should now open in the way you set it in step 3.

IntelliJ IDEA secondary windows lack a menu. How can i enable it?

I'm a frontend developer and I have a multi-monitor setup. I have HTML code on one monitor and CSS code on another monitor.
To achieve that, I drag a tab out of IntelliJ IDEA window, so that the tab opens in a separate window.
My problem is that the secondary window lacks a menu:
Menu access hot keys (e.g. Alt+V) won't work. I can't make use of the main window's menu either because when I click it, the focus switches to the active tab of the main window.
How do I access the menu when I'm working in IDEA's secondary window?
This feature is currently not available in IntelliJ IDEA.
The alternatives I could think of to do what you want:
Consider raising a feature request on http://youtrack.jetbrains.com/
Do you think it's possible that you might not miss the menu on the detached tab if instead of accessing functionality through the menu, you did the same through keyboard shortcuts?
Personally, being a keyboard junkie, I have not felt the lack of a menu on the detached tab.
Even though Eclipse allows you to create a new window for the same workspace, I had some issues with it ( for eg: if you set a breakpoint in a file in Window 1, and started a debug session from Window 2, then the file would be re-opened in Window 2 when the breakpoint is hit) and feel that the Intellij IDEA implementation works better.
(Warning! The most Hacky suggestion) Assuming you are using Windows, there are a number of ways in which you could extend the single IntelliJ window across the two monitors and then instead of detaching a tab, you could do a 'Split Vertically' in that single window. With the slider between the tabs positioned just right, it will seem you have two windows opened with each of them having a menu.
To extend a window across two monitors see : How can you maximize a window on to dual monitors in Windows 7 or use one of the multi-monitor tools listed here or here ( I vaguely recall that it was the latter 'zbar' that I used to extend a window during my eclipse days).
Believe it or not, I have done this with Eclipse when I was sick of guessing where the file-with-the-breakpoint would open up :)