Lefora Free Forum
login join
Loading
81 views

selecting window to open on CMD+N

Page 1
(items) 1–6 of 6
rookie - member
3 posts

when I press CMD+N a window called "Untitled" opens containing the text "Your document contents here"
Im following this tutorial: http://macdevcenter.com/pub/a/mac/2004/05/28/webkit.html?page=2

but the problem is that Im using XCode 3.2 and that only one outlet shows up on the "File's Owner" so I connected everything to "My Document" that did have the proper outlets.

thats the only thing I've done different, the browser is further fully functional, but the window thing really bugs me, and it said it should work.

regular - member
51 posts


Wolf

That's a rather old tutorial and both XCode and Interface Builder have moved along in 5+ years since it was written.  I'll try to find time tomorrow evening to write a new version of the Tutorial (for XCode 3.2.1) and put it on my website for you.

If you'd like me to demo and explain this, you may VNC to my computer and we can talk on Skype (or Phone).  If you'd like to take up my offer, email me at robin@clanmills.com .  I'm in California.

It's quicker and less work for me if you can VNC and Skype. Writing an on-line tutorial takes quite a lot of effort.  And of course you can follow along beside me on your computer if we use VNC.

__________________
rookie - member
3 posts

thanks for the quick response, but I rather you wrote the tutorial.
that way, someone else would be able to view it too.

also, Im Dutch, that means one of us would be having to do really crazy bed times for a live connection (different time zones).

regular - member
51 posts

http://clanmills.com/files/BYOB.pdf

If you'd like to comment about this, please email me directly robin@clanmills.com and I'll add screenshots or additional text.  I think you'll understand that it's easier to demonstrate than to document.  So I welcome your criticism - however I would like you to provide suggestions in private and I'll update the tutorial.

I am available on Saturday about 06:00PST = 15:00CET if that's convenient for you.

__________________
rookie - member
3 posts

it was a little bit hard, but I figured the tutorial out.
one question, how do I make the text say http:// when the user doesn't enter that?
I remember something about that in windows programming, but this one is kinda hard to figure out if you don't know what you're doing, because no programming is used to make it work.

regular - member
51 posts

Here's a 'no thrills' method of doing it.  It simply inspects the address.

- (IBAction) go : (id) sender 
{
NSString* address = [ addressField stringValue] ;
NSLog(@"%@",address) ;

// sniff for http:// and if missing, update the UI and the address
NSString* http   = @"http://" ;
UInt  http_l = [http length];
bool bHttp = [address length] > http_l ;
if ( bHttp ) bHttp = [[address substringToIndex:http_l] 
 caseInsensitiveCompare: http] == NSOrderedSame;
if (!bHttp ) {
// update the UI
NSString* newAddress = [[NSString alloc]initWithFormat:@"%@%@",http,address] ;
[addressField setStringValue:newAddress];
[newAddress release] ;
// reread address from the control
address = [ addressField stringValue] ;
NSLog(@"rewritten as %@",address) ;
}

// display the address in the webview
    [[webView mainFrame] loadRequest:
[NSURLRequest requestWithURL:[NSURL URLWithString: address ]
]];
}

A better way would involve using the NSURL to parse the URL and modify the scheme to http:// if missing or incorrect. An even another better approach would be to get status from the webview to find out if it had failed to load and then try various rewrites to assist the user.  In the original code, the address "file:///Users/bla/dee/bla" may be OK.  However the sniffer above changes an acceptable address into an unacceptable address.
I'm not sure what "no programming is used to make it work" means.  Are you talking about some feature of the IE ActiveX control in Windows?  I believe there's a convention (originally implemented in Mozilla browsers) to modify URLs when they fail to load. 

__________________
Page 1
(items) 1–6 of 6

Locked Topic


You must be a member to post in this forum

Join Now!