Quicktime Movie View error
I'm trying to create a very, very simple QuickTime viewer in Cocoa. I create a new Application, add QTKit and Quicktime frameworks, and drag a QuickTime Movie View into the main window.All is well if I run now (although the movie view is blank). Going back into Interface Builder, I select the Movie View and in the Inspector Attributes, I set the "Movie" field to point to a movie file: "file:///Sample/sample.mov".All is well in Interface Builder (the movie shows and plays), but as soon as I save and try to run in XCode, I get this message: /* com.apple.ibtool.errors */ Internal Error: Description: The document "MainMenu.xib" could not be opened. Operation could not be completed. (com.apple.InterfaceBuilder error -1.) Recovery Suggestion: Check the console log for additional information. The console log adds: 11/10/08 2:58:49 PM ibtool[1554] Exception raised while decoding document objects - CGSDisableUpdate returned error 1002d This doesn't appear to depend on which movie I choose, and is completely reproducable. Am I missing a step? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Newbie Question: Controls not redrawing on changes
Bah, yes, I missed Michael Ash's correct answer at the end of yesterday's digest.Setting the window backing store to "buffered" fixed the control drawing and even a coupe of other interface issues I hadn't realized were related. Thanks to everyone for your help. --Christopher Kempke ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Newbie Question: Controls not redrawing on changes
Thanks to those folks who have tried (unsuccessfully) to help me. My first post clearly contained too many magenta mackerels, so I've done what I should have started with and reduced it to a shorter example. Given the following complete, nibless, and astoundingly uninteresting app: #import int main(int argc, char *argv[]) { //return NSApplicationMain(argc, (const char **) argv); NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [NSApplication sharedApplication]; NSRect platRect; platRect.origin.x = 300; platRect.origin.y = 300; platRect.size.width = 200; platRect.size.height = 200; NSWindow* aWindow = [[NSWindow alloc] initWithContentRect:platRect styleMask:(NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask) backing:NSBackingStoreRetained defer:YES]; platRect.origin.x = 20; platRect.origin.y = 20; platRect.size.width = 100; platRect.size.height = 100; NSControl* ctl = [[NSButton alloc] init]; [(NSButton*)ctl setButtonType:NSSwitchButton]; [(NSButton*)ctl setTitle:@"Check Me"]; [(NSButton*)ctl setState:1]; [ctl setFrame:platRect]; NSView* cview = [aWindow contentView]; [cview addSubview:ctl]; [aWindow makeKeyAndOrderFront:nil]; [NSApp run]; return 0; } Clearly I'm missing something critical here (and "artistic talent" isn't what I'm looking for). What important step am I missing to make the event loop handle the drawing of my window and checkbox? --Christopher Kempke ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Newbie Question: Controls not redrawing on changes
Yes, it appears that I want an NSPanel instead of an NSWindow for my modal dialogs, but I think the modality is a red herring here: I just tried adding the same checkbox and button controls to a floating window and a document window: they don't visibly update based on mouse clicks there, either (although they still send actions to their targets) There's an [NSWindow setAutodisplay:YES] method which again looks like it's just what I need, except that it's already turned on (I just did it explicitly to be sure, no change). I've tried setting the window's backing store to BackingStoreNonretained, which also doesn't have any obvious effect. I'm correct in my assumption that this is supposed to work, yes? If I create a window, nest a checkbox in it's main view, and start the main event loop, clicks in the checkbox should keep toggling the value of the checkbox and updating the screen, right? I don't have to do anything special to turn this on, or implement the drawing myself? --Christopher Kempke On May 3, 2008, at 8:47 PM, Kyle Sluder wrote: On Sat, May 3, 2008 at 7:08 PM, Christopher Kempke <[EMAIL PROTECTED]> wrote: Thanks for the tip, but no go. It actually makes the behavior worse: now the modal dialog is still drawn, but never becomes active (the title bar never gets dark, and the previously visible (document) window never deactivates, although the dialog is drawn on top), and the default button doesn't even turn blue. Take a look at -[NSPanel setWorksWhenModal:]. You should be using an NSPanel, not an NSWindow, and must send it this message before doing -[NSApplication runModalForWindow:]. Read this document, entitled "How Modal Windows Work," for more information. http://developer.apple.com/documentation/Cocoa/Conceptual/WinPanel/Concepts/UsingModalWindows.html#/ /apple_ref/doc/uid/2223 --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Newbie Question: Controls not redrawing on changes
Thanks for the tip, but no go. It actually makes the behavior worse: now the modal dialog is still drawn, but never becomes active (the title bar never gets dark, and the previously visible (document) window never deactivates, although the dialog is drawn on top), and the default button doesn't even turn blue. --Christopher Kempke On May 3, 2008, at 3:10 PM, Nathan Kinsinger wrote: On May 3, 2008, at 3:42 PM, Christopher Kempke wrote: Then I draw the window with: [iWindow makeKeyAndOrderFront:nil]; And run it as a modal dialog with: [NSApp runModalForWindow:iWindow]; The docs for runModalForWindow: explicitly say not to send makeKeyAndOrderFront: to the window. I'm guessing that the window is in the normal run loop and not the modal run loop. makeKeyAndOrderFront: will show the window and make it key. --Nathan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Newbie Question: Controls not redrawing on changes
I'm attempting to convert my "Modern Carbon"/Windows GDI+ application framework to Cocoa for 64-bit support, and am paradoxically finding the "easy" things hard and the "hard" things easy. My latest case in point: My controls (checkboxes) aren't redrawing when they change state, and default buttons in the same dialog are drawn in blue but not throbbing.When I click on the check box, it's changing state (as determined by a call to [theControl state], but not redrawing on screen.This is all programatic; not using Interface Builder. Here's some random clips from my code. The Windows for my (modal) dialog are are created by: theWindow = [[NSWindow alloc] initWithContentRect:*(NSRect*)&platRect styleMask:winStyleMask &~ (NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask) backing:NSBackingStoreRetained defer:YES]; [theWindow setLevel: NSModalPanelWindowLevel]; I create the checkbox with: case kAOControlCheckbox: ctl = [[NSButton alloc] init]; [(NSButton*)ctl setButtonType:NSSwitchButton]; [(NSButton*)ctl setTitle:(NSString*)title]; SetPlatformCheckOrRadioValue(ctl, initValue); break; Ad add it to the parent view: [parent addSubview:ctl]; [ctl setFrame:*(NSRect*)&nrect]; if (![ctl isEnabled]) [ctl setEnabled:YES]; Then I draw the window with: [iWindow makeKeyAndOrderFront:nil]; And run it as a modal dialog with: [NSApp runModalForWindow:iWindow]; (The app itself is launched with [NSApp run]; ) This draws my dialog correctly, including all the controls. But the buttons don't visibly respond when the mouse is held down on them, default buttons are blue but don't throb, and checkboxes change programatic state but not visible state when clicked. If buttons are hooked to action targets, they're getting called when the button is clicked. I discovered by accident that when drawing a custom view elsewhere in the dialog that if I included: [[NSGraphicsContext currentContext] flushGraphics]; in the drawRect: method of the view, that all the controls would update when that view did (triggered by a mousedown handler in just that custom view). But the description of both flushGraphics and [NSButton setState] seem to indicate that it should be happening automatically. I've turned off all assignments of actions and targets, thinking I was "stealing" some event the system needed, but no go. I don't have mouseAnything: handlers on the checkboxes; in fact, I'm not even subclassing them. I'm guessing I've missed a step, something that provides the context flush and the throb heartbeat. Anyone care to take pity on me? --Christopher Kempke ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
How do I tell if the mouse button is down, independent of view, etc.?
I'm working on some code for a client, whose users (handicapped children, mainly) are using non-standard mousing devices. These are (often literally) single-switch input devices: there's no notion of position with them at all, basically just a mouse button sans actual mouse. (On-screen position is obtained by a variety of complicated mechanisms, including simple scanning, where the user pushes/blinks/ speaks/blows into a tube/whatever at the appropriate time, the exact input being dependent on their capabilities. Pretty much all of these devices just turn the "input," whatever it is, into a mouse click or keypress). A fairly common problem that comes up is simply knowing if the mouse button is down or not.I'm looking for the Cocoa equivalent of the deprecated QuickDraw "Button()" function -- just tell me whether (a particular or even just any) mouse button is currently pressed or not. Mousedown handlers don't seem to be doing it for me, because I don't know what to put them on: I need to know whether the mouse is down regardless of modality, what window's in front, where the cursor is, and even whether or not the mouse is in one of my app's windows at all. I could live with keeping track of every mouse down and up, so long as there's a way to do it globally (even while in the background). I'm guessing this has come up before, but searching for "Button()" isn't helping. Any hints? I'll eventually need the same thing for keystrokes (the equivalent of deprecated GetKeys()), too, so I'd take hints there, as well. --Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]