Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Ken Thomases
On Nov 1, 2011, at 6:31 PM, Jens Alfke wrote: > On Nov 1, 2011, at 3:06 PM, Vojtěch Meluzín wrote: > >> Anyway we are getting out of the topic. Does anyone here know why the modal >> windows work in a plugin (in a normal application) and not from a console >> application? > > Basically, apps a

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Ok, so even the keyboard input is related to the console application. With normal "bundled" Cocoa app it works. Cursors are still missing though. Anyway a good thing to remember: don't use console app to test GUI stuff :). Vojtech Dne 2. listopadu 2011 0:46 Vojtěch Meluzín napsal(a): > I used ru

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
I used runModalForWindow, that should handle the even loop, right? Anyway it seems working now. But still the keyboard events and mouse cursors don't work... Vojtech Dne 2. listopadu 2011 0:41 Scott Ribe napsal(a): > On Nov 1, 2011, at 4:06 PM, Vojtěch Meluzín wrote: > > > Does anyone here know

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Scott Ribe
On Nov 1, 2011, at 4:06 PM, Vojtěch Meluzín wrote: > Does anyone here know why the modal > windows work in a plugin (in a normal application) and not from a console > application? Lack of a run loop? Or did you run one yourself in the console app? -- Scott Ribe scott_r...@elevated-dev.com http:

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Thanks Jens. Btw. I fixed it with this: [window setLevel: CGShieldingWindowLevel()]; I googled it, but I'm just not sure if cannot have some "bad" side-effects. Vojtech Dne 2. listopadu 2011 0:31 Jens Alfke napsal(a): > > On Nov 1, 2011, at 3:06 PM, Vojtěch Meluzín wrote: > > Anyway we are g

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Jens Alfke
On Nov 1, 2011, at 3:06 PM, Vojtěch Meluzín wrote: > Anyway we are getting out of the topic. Does anyone here know why the modal > windows work in a plugin (in a normal application) and not from a console > application? Basically, apps aren’t intended to be launched by a plain exec. A normal l

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Don't worry, the allocation seems working now. A few autorelease pools did the trick. I know just the most basic stuff and don't intend to learn more simply because I'm not planning to use it at all. The simple layer only calls other functions made in C++. That's all I need. Anyway we are getting

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Jens Alfke
On Nov 1, 2011, at 11:41 AM, Vojtěch Meluzín wrote: > Yaj, ok, can you explain a little more? I don't know much about Objective C, > how should the MStringToNSString be implemented to create the autoreleased > NSString? (sorry for lack of knowledge, but I just don't plan any further > developm

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Ok, here's an interesting development: 1) In a simple "console" application the modal window is initially hidden. 2) In a plugin the window is displayed above and even nested modal windows are displayed correctly. So could it be just by the fact that the testing application was "console" app? Voj

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
> I don't really know C++, so there is some generalization here. Since > you are returning a retained NSString, presumably inside your function > are you are doing something like: > > return [[NSString alloc] initWithCString:stringFromCPlusPlusMethod > encoding:someEncoding]; > > To return an auto

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
> > I'm using my own styles. It may be no according to HI guidelines, but to > be > > honest, I don't care. The app/plugin should look the same on all > platforms. > > That is up to you, but be warned that the Apple userbase in general is > negatively reactive to interfaces that feel non-native. >

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Preston Sumner
On Nov 1, 2011, at 12:41 PM, Vojtěch Meluzín wrote: > Thanks Jens. > > On the other hand now runModalForWindow increases retainCount! Why is that? retainCount should not be used to debug memory management issues--or at all, really. > I'm using my own styles. It may be no according to HI guide

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/1/11 11:41 AM, Vojtěch Meluzín wrote: > But the retainCount is needed for successful release of the window, > right? I allocate the window and then deallocate it when I'm > finished with it. But runModalForWindow increases retainCount to 2, > so

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Sure. I used AbortModal, just in case it's not from the main thread, then performed release once, since I have also allocated it. Still 1 remains. I also used autorelease pool in for the modal processing. But still retainCount is 1 after my release. And after that Mac OS tries to redraw the view...

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Gary L. Wade
Did you try calling stopModal or one of its variants before releasing it? And, did you release the window rather than dealloc'ing it? Try those to get rid of your crash. -- Gary L. Wade http://www.garywade.com/ On 11/01/2011 11:41 AM, "Vojtěch Meluzín" wrote: >But the retainCount is needed for

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Scott Ribe
On Nov 1, 2011, at 12:33 PM, Vojtěch Meluzín wrote: > Why would it? It's AFTER the runModalForWindow ends, so the window is not > used anymore, is it? Even so, you agree it should retain it, no? Now, should it release it or autorelease it when it's done? Examining retain counts is almost always

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Thanks Jens. On the other hand now runModalForWindow increases retainCount! Why is that? > It makes no sense to me. > > > It’s probably being retained and then autoreleased by AppKit. Don’t pay > any attention to retainCount, it’s generally not useful for detecting > memory issues. > > However, no

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
> > On the other hand now > > runModalForWindow > > increases retainCount! Why is that? It makes no sense to me. > > Why wouldn't it? Why would NSApp not retain the window that it's running > modally??? > Why would it? It's AFTER the runModalForWindow ends, so the window is not used anymore, is it

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Scott Ribe
On Nov 1, 2011, at 9:43 AM, Vojtěch Meluzín wrote: > On the other hand now > runModalForWindow > increases retainCount! Why is that? It makes no sense to me. Why wouldn't it? Why would NSApp not retain the window that it's running modally??? -- Scott Ribe scott_r...@elevated-dev.com http://www

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Jens Alfke
On Nov 1, 2011, at 8:43 AM, Vojtěch Meluzín wrote: > On the other hand now runModalForWindow increases retainCount! Why is that? > It makes no sense to me. It’s probably being retained and then autoreleased by AppKit. Don’t pay any attention to retainCount, it’s generally not useful for detect

Re: Problems with runModalForWindow, looking for alternatives

2011-11-01 Thread Vojtěch Meluzín
Thanks Jens. I solved the crash problem - I now call setReleasedWhenClosed FALSE for the window and it seems helping. On the other hand now runModalForWindow increases retainCount! Why is that? It makes no sense to me. Also the window still appears in background (code below) and cursor cannot be ch

Re: Problems with runModalForWindow, looking for alternatives

2011-10-31 Thread Jens Alfke
On Oct 31, 2011, at 6:00 PM, Vojtěch Meluzín wrote: > I tried using runModalForWindow, but found following problems: > 1) The method seems to release the window or something. If I don't call > [NSWindow retain] before calling it, further calls lead to a crash. > Therefore I cannot show subwindows

Problems with runModalForWindow, looking for alternatives

2011-10-31 Thread Vojtěch Meluzín
Hi, I'm implementing audio-units plugin(s) using Cocoa views. The plugin occasionally shows a popup window and it is also possible that additional popups will be shown from the first one. In all cases it's needed to avoid all GUI processing of the plugin host and the main window, except for timers