nswindowcontroller + program execution [duplicate] - cocoa

This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Cocoa: I've got my user's input - Now what?
I am trying to use nswindows controller to handle user inputs during the program execution.
I am able to get the user input in a nstextfield but when i am clicking on the ok or cancel button, their respective IBAction methods are getting executed and the control is not getting returned to the previous execution place that should execute after the nswindowcontroller gets the user input. Please suggest me a way to get over this.
Thanks

What do you mean by "the previous execution place"? Cocoa apps are event-driven, you are pretty much always just responding to user input.
What is your app doing?

Related

How do I make the GUI responsive after launching a specific function? [duplicate]

This question already has answers here:
Background thread with QThread in PyQt
(7 answers)
Example of the right way to use QThread in PyQt?
(3 answers)
In PyQt, what is the best way to share data between the main window and a thread
(1 answer)
Closed 4 months ago.
I set up a GUI and so far, everything works as it should, except of one thing. There is a button which means "Start" and calls a function/algorithm. Within this function, some inputs are needed from the user (via a QLineEdit) and here begins the trouble.
What I want to have is the following:
User enters a number into the QLineEdit and presses a button (let's call it Next) so the algorithm can proceed.
At the moment, the algorithm simply takes the number, entered in this specific QLineEdit before the start button was pressed, for each step. And the problem is, I'm not able to enter a number again until the algorithm finished.
From my understanding the issue lies in the fact that the GUI is not responsive when entering the algorithm. How could I do that?
The next button doesn't work, yet, because I don't know how to do so.

Bash: listining the pressed key while being in another window/application

my problem is, I coded a bash-script for a stop-timer for speedruns (like livesplit). The Timer is working, but I*d like to operate the script with a hotkey while I am using another apllication/window. (the concrete Problem is, I need a method for asking within a if-loop if a certain button is pressed, it has to work while I am in another application.
thanks in advance,
Nulli

How can I tell if the Window Handle is main window handle?

Hello hello Thank you for reading my question.
I am currently building a program which detects new window creation / termination.
Gratefully, I have successfully managed to implement WinEvents and SetWinEventHook to capture events and filter window creation and termination.
However, I am facing a challenging task to accurately filter correct Window handles.
For example when putty.exe runs, many handles including main handle, button handle...etc are captured by my function.
However, I only desire to filter main Window handle.
Therefore, I used if statement as following.
if (event == EVENT_OBJECT_CREATE && GetParent(hwnd)==NULL)
This seemed to work for a while.
However, this if statement prevented my program from capturing child window's main handle.
Is there any way to tell if Window handle(HWND) belongs to main window?
My colleague tells me to implement GetWindowLong and compare style.
But, I have no clue about that.
If anyone knows answer, please help.
Again thanks for reading this question.

Retaining an NSWindow size and state - looking for an elegant way to do this

I have a controller class which spawns a window when a certain condition occurs. This window can be closed by the user, moved around or resized.
Ideally, when this condition occurs, I'd like the window to re-open in the same spot the user closed it last time.
Looking for an elegant way to do this. Pointers (or references) will be most welcome.
Luckily, AppKit knows this is a common pattern and has provided -setFrameAutosaveName:, which does this automatically for you. (If you're using NSWindowController you'll want to call setShouldCascadeWindows:NO, which will override this.)

How can I programmatically determine if an application is flashing in the taskbar [duplicate]

This question already has an answer here:
Is there a Windows API hook for "this application wants attention"?
(1 answer)
Closed 9 months ago.
I can use "FlashWindowEx" to make a window flash in the taskbar, but what can I call to determine if that has been done to a window? Is there a flag that gets set somewhere that I can query?
It's seems that such thing is not possible.
However, there may be workarounds.
For example, you may keep a boolean variable "flash = false". Then set it to "true" when you call FlashWindowEx and set to "false" in the situations in which applications typically gain focus.
References:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1846008&SiteID=1

Resources