On Mar 12, 2007, at 4:10 AM, Allan Odgaard wrote:
in your project, have a few items already added, and ready to be commited. Have a new item in your tree. Bring up the commit window. Click add next to that file, and click the checkbox, type your message in and hit enter. The commit will fail.
I’ll try it the next time I get the chance (I ought to have a test svn repository ;) )
It does not reproduce for me. It must be that something is writing the text "CMPluginExamineContext" to stdout when you invoke the popup menu,
But weird that someone writing to stdout, fools the process, no?!?
No, CommitWindow returns data via stdout, because it's called from the commit script like a normal tool. Things like NSLog write to stderr, which is why this is not usually a problem. Ultimately, probably, some small bits of CommitWindow should be added to a plugin and the main logic should be implemented through tm_dialog, which will eliminate the possibility of this sort of problem.
An alternative is either using an NSPopUpButtonCell or so, but I ran into problems with that approach (it is sort of hacky, because you’d use a cell without a view, or a view outside a view hierarchy), so I use the Carbon Menu Manager for custom pop-ups, there is some code for this in the Dialog plug-in (if you wish to switch the current code, or I could do it ;) ) -- the only tricky part with Menu Manager is, that it uses global coordinates relative to the main screen, where I found, by experimentation, that the main screen is the one with its origin in (0, 0), not feeling overly confident though, that this is really how it is defined. But [NSMenu mainScreen] was not (always) the right one…
In Carbon, IIRC, the screen at topleft (0,0) is always the screen containing the menubar. This would have been necessary for compatibility with apps written before multiple monitor support (which arrived in 1987). According to the docs, [NSScreen mainScreen] returns the screen containing the key window, which probably made sense in menubarless NeXTstep... although, even then, why not just get the key window and ask for its screen?
Chris