• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How to "pop-up" custom dialog from command line tool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to "pop-up" custom dialog from command line tool


  • Subject: How to "pop-up" custom dialog from command line tool
  • From: Andrei Tchijov <email@hidden>
  • Date: Sun, 6 Nov 2005 14:30:25 -0500

Hi,
I need to pop-up dialog to ask for password from one of my command line tools. So I have to questions to answer:
- how to add secure text field to standard alert panel,
- how to pop-up dialog from command line tool.
I was able to find answer to my first question on cocoabuilder (http://www.cocoabuilder.com/archive/message/cocoa/2005/5/12/135634), but it looks like I am stack with second one. Below you can find a code I have come up with. It does show dialog, but it appears behind terminal window I have started my tool from and it does not want to accept keyboard input (even after I made it "top application" by clicking on it, terminal keep receiving keystrokes) (the funny thing is that "text field" does have blue border as if it has focus and I can click on buttons ).
...
id panel = NSGetAlertPanel(
@"Password",
@"Please enter password for %@@%@/%@",
@"OK", nil, @"Cancel",
account, serverName, ( path == nil ? @"" : path )
);

id contentView = [ panel contentView ];

id passwordField = [[ NSSecureTextField alloc ] initWithFrame: NSRectFromString( @"20 20 100 20" )];

[ contentView addSubview: passwordField ];

[[ NSApplication sharedApplication ] activateIgnoringOtherApps: YES ];
int i = [NSApp runModalForWindow:panel];
...


Your response will be highly appreciated,

Andrei Tchijov
Leaping Bytes, LLC

     web: www.leapingbytes.com
   email: email@hidden
      AIM: leapingbytes
Google: email@hidden
      ICQ: 151229319




_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Core Data: autoreleasing an invalid object?
  • Next by Date: Re: Image and title in NSPopUpButton
  • Previous by thread: Re: Core Data: autoreleasing an invalid object?
  • Next by thread: how to add multiple-selection pull-down menu in IB?
  • Index(es):
    • Date
    • Thread