Re: Cocoa-Java : how to manage multiple windows, dinamic windows and open/save dialog
Re: Cocoa-Java : how to manage multiple windows, dinamic windows and open/save dialog
- Subject: Re: Cocoa-Java : how to manage multiple windows, dinamic windows and open/save dialog
- From: Erik Buck <email@hidden>
- Date: Wed, 14 Feb 2007 10:48:24 -0800 (PST)
> I can't find any tutorial that explains how to manage multiple windows:
> example i have a window with a form, if i push the ok button i have
> to visualize another window with the report of the action
There are lots of examples including TextEdit and Sketch on your hard disk.
You need to understand Cocoa's target/action system and possibly the Responder Chain.
You need to set the target and the action for the "ok" button. In your action method, you will want to create or load your visualization window and then send the -orderFront: message to the window. By the way, "OK" is a terrible name for a button. Try naming it "Show Visualization".
>another thing that i can't understand is how to change the amount of
>text fields on a report window:
You probably don't want to use text fields the way you are. Consider NSTableView or NSMatrix instead.
>example: i created an app that read from a tcpdump file and i want to
>visualize the result of my calcs, but i can't decide 'a priori' the
>number of items that will be visualized, sometimes they should be 1
>or 2, in another case, the most frequent, between 30 and 200.
>Is it possible to creat the NsTextField or other Cocoa items
>dinamically and adding them to the new window?
Of course you can create new NSTextField instances dynamically and add the as sub-views of an existing view such as the content view of your "Visualization" window. See See many examples including this one: <http://graphics.stepwise.com/EMB/RadioSample.zip> There is a description here: <http://www.cocoabuilder.com/archive/message/cocoa/2004/10/7/11900>. This was discussed again in this forum just yesterday http://www.cocoabuilder.com/archive/message/cocoa/2007/2/13/178719
Nevertheless, I have doubts that you ready want to do all of the work of dynamically adding views when NSTableView or NSMatrix will probably meet your needs. The newbieness of your questions suggest that you are not ready to mess with the view hierarchy.
> the last question is: how have i to do to use Open / Save dialogs?
http://developer.apple.com/cgi-bin/search.pl?q=NSOpenPanel&num=10&site=default_collection
You might also enjoy a good book about Cocoa programming.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden