Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / June 2005



Tip: Looking for answers? Try searching our database.

Newbie.. how do I find method names..

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Leo Lapworth - 09 Jun 2005 17:19 GMT
Hi,

I've just started playing with CB and I followed the example docs...

But when I switch to using a NSTextView, rather than an NSTextField
it seems I have to change the method names.

I just want to change the copy in the NSTextView, but setStringValue()
does not work.

I have tried looking through the documentation in xCode and the
web, but I end up getting confused, looking at Java and Object-C
methods etc.

So my question... how do I look up what methods should be used
in relation to a specific GUI element?

Thanks

Leo

ps.
Outlets example seems to have a copy/paste bug (though I could be  
wrong)..

sub saySomething : Selector(sayHello:) IBAction {

should that not be:

sub saySomething : Selector(saySomething:) IBAction {
Sherm Pendley - 09 Jun 2005 17:59 GMT
> I've just started playing with CB and I followed the example docs...
>
[quoted text clipped - 3 lines]
> I just want to change the copy in the NSTextView, but setStringValue()
> does not work.

NSTextView is considerably more complex. It works with instances of  
several other classes - NSTextContainer, NSLayoutManager, and  
NSTextStorage among others.

To change the copy in an NSTextView, you first need to get a  
reference to the NSTextStorage object it's displaying:

my $textStorage = $textView->textStorage();

NSTextStorage is a subclass of NSMutableAttributedString, so we can  
use that class' setAttributedString() method to assign a new string.  
But that method takes an instance of NSAttributedString as its  
argument, so we need to create one first:

my $attributedString = NSAttributedString->alloc()->initWithString
("Hello");
$textStorage->setAttributedString($attributedString);

There's an overview of the text system architecture on Apple's  
developer site, at:
    <http://developer.apple.com/documentation/Cocoa/Conceptual/
TextArchitecture/index.html>

Apple occasionally decides to move the local docs around, but if  
you're using the same Xcode version I am, this link might work for you:
    <file:///Developer/ADC%20Reference%20Library/documentation/Cocoa/
Conceptual/TextArchitecture/index.html>

> I have tried looking through the documentation in xCode and the
> web, but I end up getting confused, looking at Java and Object-C
> methods etc.
>
> So my question... how do I look up what methods should be used
> in relation to a specific GUI element?

You've got the right idea - Apple's Cocoa docs.

I've posted a general guideline to help read Objective-C code here:

    <http://camelbones.sourceforge.net/documentation/concepts/
readobjc.html>

Ideally, it would be best to have a complete set of reference  
material that's geared towards Perl. But in practice that's too much  
for me to do alone. I can's simply copy-and-paste Apple's docs -  
they're copyrighted. And there's far, far too much material needed  
for me to write it all.

> Outlets example seems to have a copy/paste bug (though I could be  
> wrong)..
[quoted text clipped - 4 lines]
>
> sub saySomething : Selector(saySomething:) IBAction {

Yep - you're right. Fixed it.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Leo Lapworth - 10 Jun 2005 11:41 GMT
Hi,

Sherm - Thanks for the info about the docs...

I still find it hard to read... so my first project is going to be a  
combination
of WWW::Mechanize and HTML::Parser to generate a nicer list of  
documentation,
initially as HTML, but eventually as a CB App (once I have the  
documentation!)

I want to end up with a tree structure something like

<Class Name>
       <method>
       <method>
    <inherited classes>
        <Class name>
            <method>
            <method>

So from any class you can see all methods - even if they are  
inherited, I will still
maintain links to the description of methods etc. I'm not sure about  
the Conforms to yet, but that
can be phase 2.

I will parse:
file:///Developer/ADC%20Reference%20Library/documentation/Cocoa/
Reference/ApplicationKit/ObjC_classic/index.html

Go into each Class , find all inherited classes and process the HTML  
from there.

Does anyone see any problems with this? - is there a better source to  
parse?

Cheers

Leo
Leo Lapworth - 10 Jun 2005 14:07 GMT
> I still find it hard to read... so my first project is going to be  
> to generate a nicer list of documentation,

Just for the archives - I've been pointed to:

http://homepage.mac.com/aglee/downloads/appkido.html

Which already seems to do exactly what I wanted... guess I'll have to  
think
of something else for my first CB App!

Cheers

Leo
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.