Hello everyone! I would like to ask your help with a specific problem I have.
I need to implement the following thing: There is a control displaying numeric value. When you Double-Click on a control small white window appears where you can enter the value, and when you press enter the value will be updated. You can see this screenshot (Ignore the fact it is from Windows 7): http://i31.fastpic.ru/big/2012/0102/5e/3d39b295e3dc2642ff1d0f240da0c95e.png Here is the code. I do it not within the main view but from the side function. The superView is the main view. NSRect textRect = NSMakeRect(in_location.m_x, in_location.m_y, in_size.m_x, in_size.m_y); NSTextField* textField = [[NSTextField alloc] initWithFrame:textRect]; // Configure the text field [textField setEditable:YES]; [textField setSelectable:YES]; [textField setWantsLayer:YES]; [textField setImportsGraphics:NO]; [textField setBordered:NO]; [textField setBezeled:NO]; [textField setBackgroundColor:[NSColor whiteColor]]; [textField setDrawsBackground:YES]; [textField setTextColor:[NSColor blackColor]]; [textField setAllowsEditingTextAttributes:NO]; [textField setAutoresizingMask:(NSUInteger)(NSViewWidthSizable + NSViewHeightSizable)]; // Embed the text field in our plug-in view. [superView addSubview:textField]; [superView setAutoresizesSubviews:YES]; // Make the text field "in focus", and start an editing session on it [textField becomeFirstResponder]; Now I tried 2 approaches: 1) *out_dismissedKey = [NSApp runModalForWindow:[textField window]]; [textField removeFromSuperview]; [textField release]; This one works. The text window gets all the events and I can get what I want. However, the windows order get screwed, meaning if there are couple of windows open in the same application the superView gets beyond other windows and I can not get it on front again. So I tried the second approach - sheets: 2) [textField beginSheetModalForWindow:[superView window] modalDelegate:superView didEndSelector:0 contextInfo:0]; [textField removeFromSuperview]; [textField release]; Now the problem here is that I am getting stuck in this function. The window is opened but neither Enter nor Escape do not close it. So the caller function can not continue, meaning I can not reach [textField removeFromSuperview]. Can someone help me either with first or the second issue? I understand that the explanation may be insufficient, I am ready to give more and the screenshots if anyone wishes. Thanks! [cid:image001.jpg@01CCC950.1B952E70] Dany Golubitsky Software Engineer Waves Audio Ltd Tel: +972 3 608 4157 Fax: +972 3 608 4056 www.waves.com<http://www.waves.com/>
<<inline: image001.jpg>>
_______________________________________________ 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 arch...@mail-archive.com