[comp.sys.next] novice questions about IB

amra@cis.ohio-state.edu (Nasir K Amra) (07/03/89)

	Can I simply say:
		[panel_outlet display];

	in the method of the object that is supposed to respond to a
button click with displaying a panel that was previously hidden. Or,
do I have to do some more preparations. All view objects in my program
was created by IB and I've hooked up the proper target/action &
outlet/panel connections, but I get an warning message with the following
method:

- displayresultpanel: sender
{ [ resultpanel display];
   return self;
}

where the warning message states that ' can not find method' ( I assume
display) and another warning message : 'return type for display defaults to
id'

	When I run the compiled program, clicking on the button does
not bring up the panel.

	Any help would be greatly appreciated.



== Nasir

ali@polya.Stanford.EDU (Ali T. Ozer) (07/05/89)

In article <53602@tut.cis.ohio-state.edu> Nasir K Amra writes:
> ... I get an warning message with the following method:
>
>- displayresultpanel: sender
>{ [ resultpanel display];
>   return self;
>}
>
>where the warning message states that ' can not find method' ( I assume
>display) and another warning message : 'return type for display defaults to
>id'

You should "#import" the interface for any class referenced/used in 
a file. In the above example you say the "resultpanel" instance variable
is a object of class Panel; in that case, you should have a 

#import <appkit/Panel.h>

at the top of the above .m file. This will assure that all Panel methods
are known to the compiler, and if you get any warnings, you are indeed
calling a method that doesn't exist.

The method that makes panels and windows to come on-screen is
orderFront:, not display. The display method causes a redraw of the
whole panel, including the border view and the content view, and
all subviews. orderFront: simply brings the panel on screen.

Because orderFront: is a target-action method, you can usually connect 
a button or menu item to a panel or window without having to create
a glue method; in the above case you wouldn't need the displayresultpanel:
method, for instance.

Ali Ozer, NeXT Developer Support
aozer@NeXT.com

amra@python.cis.ohio-state.edu (Nasir K Amra) (07/05/89)

AHHHH, I see now what I did wrong. You have certainly clarified a lot for
me. However, since I want to record that the button was clicked in a log
file that records such events, it seems to me I can't go directly from
the clicked button to the panel, but must interject an intermediate object
for that extra processing. Do you know of any other way I could do it?

		Thanks a lot,
		Nasir Amra

-=-
Nasir K. Amra
amra@cis.ohio-state.edu