Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Nonnus3G

macrumors member
Original poster
Jul 9, 2008
52
0
hello

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 ?
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
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.
 

Nonnus3G

macrumors member
Original poster
Jul 9, 2008
52
0
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 ?
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
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?
 

Nonnus3G

macrumors member
Original poster
Jul 9, 2008
52
0
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)
 

Nonnus3G

macrumors member
Original poster
Jul 9, 2008
52
0
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 !
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.