|Oct 31, 2008, 03:04 PM||#1|
osx user input
i need to get simple user input, lets say a string from a text field
i wanted to display an alert asking the user to input the info with ok and cancel buttons
i checked NSAlert and it gives me the popup and the buttons but not text field
do i need to create a small window with all elements (textfield, button, etc) and display it or is there any builtin UI for this ?
|Oct 31, 2008, 05:07 PM||#2|
Yes you need to create your own window. I'd suggest creating a separate nib for the window, and then subclass NSWindowController which handles the nib loading and window displaying.
|Oct 31, 2008, 06:59 PM||#3|
thats what i did
but i included it in the same nib,
is there any reson why i shouldnt ?
i reference it and i just use [myWindow orderFrontRegardless] to make it visible...
however it is not showing with the usual shadow and the ui elements are not working ok,
the button trigger the assgined IBActions but do not show on press visuals and textfield does not receive text at all although it is set up as editable and selectable in ib (is this correct ?)
any ideas ?
or is it related to me simplifying what you mention in your post ?
Last edited by Nonnus3G; Oct 31, 2008 at 07:07 PM.
|Oct 31, 2008, 07:08 PM||#4|
The main reason to use a separate nib is the nib's objects are only loaded when needed, but for most apps it's not that big of a deal.
I can't really say what's going on with your app without some code. Are you using modal windows?
|Oct 31, 2008, 08:23 PM||#5|
no, not at all
my app does not even have a main window,
just menu and status bar item
in the mainmenu nib i included a NSWindow with desired elements in
and assigned it to a IBOutlet NSWindow *chosePort
in ib the window was set up as shadowed, not visible at startup
i bring up the window with [choosePort orderFrontRegardless];
but even if i did not have this and made the window appear on start it would have the same weird behavior, no shadow, the buttons dont change visually when pressed and text edit does not receive text (although it changes cursor)
|Oct 31, 2008, 11:33 PM||#6|
i got it displaying ok by messing with ib memory option for NSWindow
i also started to use [choosePort makeKeyAndOrderFront:nil]
to force focus on the popup window
all is good except i am now having a hard time to get the NSTextField content !
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|How do I get an integer user input from command line?||ataylor2009||Mac Programming||5||Mar 20, 2009 12:43 AM|
|iPhone User Input Word List||Aephel||Wasteland||1||Nov 22, 2008 10:25 PM|
|Slow to respond to user input||deniser||iPhone Tips, Help and Troubleshooting||7||Jul 15, 2008 02:09 PM|
|User Input||ghking||Web Design and Development||0||Oct 11, 2007 02:03 PM|
|is there a security mode where user input requires a password but is not sleep?||motulist||Mac Applications and Mac App Store||6||Jun 10, 2004 11:04 PM|
All times are GMT -5. The time now is 10:44 PM.