discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A few more newbie questions


From: Dr. H. Nikolaus Schaller
Subject: Re: A few more newbie questions
Date: Wed, 4 Apr 2012 16:55:56 +0200

Hi,

Am 04.04.2012 um 16:46 schrieb Omar Campos:

> Hi all,
> 
>   Now that I've read some of the introductory tutorials, I started to develop 
> my first GNUStep app. Nothing too complicated, of course. In working on it, 
> I've come up to a few doubts. 

welcome!

> Your input will be of great help.
> 
> 1. Nicola Pero's tutorial on NSButton teaches how to replace a window's 
> content rect with a NSButton. While this fits the purposes of the tutorial, I 
> wanted to add more than one control to the window. But I was unable to find a 
> way to make -addSubview work on NSWindow (it seems that it is a subclass of 
> NSResponder and not of NSView). So what I did was that I used an NSBox and 
> set it as the NSWindow's content rect. Now I can add more controls to the 
> window. Is there an alternate way to do this? Also, is there a way to remove 
> an NSBox's title? I tried to use -setTitle:@"", but I still get a blank space 
> where the title is supposed to be.

NSWindow is a class that displays a window frame and a single view, the 
contentView. It is sort of a canvas and/or window background decorator.
This can be replaced by another view like a NSBox.

But you can also add multiple subviews to the contentView and define their 
frame (-setFrame:). This allows to position them as you like (but avoid that 
they overlap).

code snippet: [[window contentView] addSubview:subview];

> 
> 2. What exactly is the NSResponder class for? I think it was to do with event 
> handling.

NSResponder is an abstract superclass for all objects that can receive events. 
And it defines the responder chain methods.

NSWindows can receive/handle events (e.g. the close button) and Views as well. 
So both, NSWindow and NSView are subclasses of NSResponder.

NSResponder also defines some default behaviour that can be overwritten in the 
specific subclasses.

> 
> 3. The tutorials tell me to use the "openapp" command to execute my app. Is 
> there a reason why I couldn't invoke the application's executable directly? 
> Also, I've found that if I do "make install", I can execute the application 
> without "openapp". It seems "make install" copies the necessary app files 
> into folders where they can be found in the environment. Will this affect me 
> somehow when I try to create an app installer?
> 
> Thanks for any info, as always.
> 
> SIncerely,
> Omar
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep




reply via email to

[Prev in Thread] Current Thread [Next in Thread]