<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>g-Off.net &#124; Geoffrey Foster &#187; objective-j</title>
	<atom:link href="http://g-Off.net/tag/objective-j/feed" rel="self" type="application/rss+xml" />
	<link>http://g-Off.net</link>
	<description></description>
	<lastBuildDate>Fri, 30 Oct 2009 00:12:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Cappuccino/Objective-J and URLTextField</title>
		<link>http://g-Off.net/software/cappuccinoobjective-j-and-urltextfield</link>
		<comments>http://g-Off.net/software/cappuccinoobjective-j-and-urltextfield#comments</comments>
		<pubDate>Thu, 19 Mar 2009 01:32:25 +0000</pubDate>
		<dc:creator>gfoster</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[cappuccino]]></category>
		<category><![CDATA[objective-j]]></category>
		<category><![CDATA[objj]]></category>

		<guid isPermaLink="false">http://g-Off.net/?p=34</guid>
		<description><![CDATA[I wanted to display a link in a Cappuccino web application but there doesn't seem to be a very "nice" way of doing that so I wrote up the URLTextField class. It's basically a regular CPTextField but the CPTextFields DOMElement is wrapped in another DOMElement that provides the anchor tag. Use it like a normal [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to display a link in a <a href="http://www.cappuccino.org">Cappuccino</a> web application but there doesn't seem to be a very "nice" way of doing that so I wrote up the URLTextField class. It's basically a regular CPTextField but the CPTextFields DOMElement is wrapped in another DOMElement that provides the anchor tag. Use it like a normal CPTextField and call setStringValue: with the text you'd like displayed for the link, and use setLink: with a valid URL to set the link. A convenience initWithFrame:link:title: is also available that sets it all up from the get-go.<span id="more-34"></span></p>

<div class="wp_codebox"><table><tr id="p342"><td class="code" id="p34code2"><pre class="objj" style="font-family:monospace;">// Copyright (c) 2009 Geoffrey Foster
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the &quot;Software&quot;), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
&nbsp;
@import &lt;AppKit/CPTextField.j&gt;
&nbsp;
@implementation URLTextField : CPTextField
{
    CPString _link;
    DOMElement _DOMAnchorElement;
}
&nbsp;
- (id)initWithFrame:(CGRect)aFrame
{
    return [self initWithFrame:aFrame link:@&quot;&quot; title:@&quot;&quot;];
}
&nbsp;
- (id)initWithFrame:(CGRect)aFrame link:(CPString)link title:(CPString)title
{
    if(self = [super initWithFrame:aFrame])
    {
		_link = link;
		[super setStringValue:title];
&nbsp;
        _DOMAnchorElement = document.createElement(&quot;a&quot;);
        _DOMAnchorElement.href = link;
        _DOMAnchorElement.title = title;
&nbsp;
        var element = _DOMElement.removeChild(_DOMTextElement);
        element.style.cursor = &quot;pointer&quot;;
        _DOMAnchorElement.appendChild(element);
        _DOMElement.appendChild(_DOMAnchorElement);
	}
	return self;
}
&nbsp;
- (void)setLink:(CPString)link
{
    _link = link;
    _DOMAnchorElement.href = _link;
}
- (CPString)getLink
{
    return _link;
}
&nbsp;
- (void)setStringValue:(CPString)anObject
{
    [super setStringValue:anObject];
    _DOMAnchorElement.title = anObject;
    [super sizeToFit];
}
&nbsp;
@end</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://g-Off.net/software/cappuccinoobjective-j-and-urltextfield/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
