Web View

Here is where the magnanimous folks that create externals post them (.zip archives only please).

Web View

Postby sctell » Mon Jan 19, 2009 12:36 pm

Hi,

I have been playing again following a request for flash in SC.

Now, before I post a link to the external please be aware that this is a 30 minute blast to show that it is possible.

This external is for trying out and is liable to crash.

Click on the init button then the loadURLText button then play from there. It does not seem to download.

I am sure there is lots to do. So please ask.

SCWebView.bundle.zip
(23.66 KiB) Downloaded 383 times
Last edited by sctell on Sun Dec 22, 2013 10:17 am, edited 6 times in total.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby johnjohnston1 » Mon Jan 19, 2009 2:09 pm

Very cool Terry,
Interestingly I can't edit a script once I've called init. I can open the script wd but not type in it.
seems you can pass the external the url to a swf and it loads that giving direct flash in SC without any html.

As well as flash this would let us format fields and do lots of interesting things.

I don't know where you are going with this but Tomas' webkit external let SC 'trap' click on links, javascript etc

cheers

john
User avatar
johnjohnston1
 
Posts: 196
Joined: Sun Jul 06, 2008 10:42 am
Location: Glasgow, UK

Re: Web View

Postby bookbuzz » Mon Jan 19, 2009 4:31 pm

Terry,
Thanks for a look at the Web View external. I am playing with it in my project. This has GREAT POSSIBILITIES!

Here is one hiccups:

1) the page data doesn't update to reflect changes to the uploaded data - although I have revised the code on the URL I was calling, I don't see the changes within the project. The changes do show within Safari. Is there a way to purge the cached data?

Thanks,

Bookbuzz
bookbuzz
 
Posts: 13
Joined: Tue Jan 13, 2009 3:54 pm

Re: Web View

Postby sctell » Tue Jan 20, 2009 2:37 am

Hi,

Having browsed through the WebView Class there a hundreds of available functions.

I have decided to implement these first and achieve a stable external to which other functions can be added.

stopLoading
reload
setDrawsBackground
setMaintainsBackForwardList
goBack
goForward
makeTextLarger
makeTextSmaller
mainFrameURL
stringByEvaluatingJavaScriptFromString

Could someone with experience or an interest perhaps produce a limited list of functions that may be useful to all.

The class reference can be found here:
http://developer.apple.com/documentation/Cocoa/Reference/WebKit/Classes/WebView_Class/Reference/Reference.html

johnJohnston said
Interestingly I can't edit a script once I've called init. I can open the script wd but not type in it.


I think that is just because it is not stable yet. It needs work.

johnjohnston said
I don't know where you are going with this but Tomas' webkit external let SC 'trap' click on links, javascript etc


I had a look for Tomas' webkit external but externals.net would not come up (Network Error).
What is the list of functions in this external.
Is it not now compatible with SC? That would save some work.

bookbuzz said
the page data doesn't update to reflect changes to the uploaded data - although I have revised the code on the URL I was calling, I don't see the changes within the project. The changes do show within Safari. Is there a way to purge the cached data?


there is a reload function, that should do it? Not implemented yet.

I will update the external to try and make it stable with the extra functionality listed above.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby Dave_Higgins » Tue Jan 20, 2009 7:13 am

haden_young wrote:I had a look for Tomas' webkit external but externals.net would not come up (Network Error).
What is the list of functions in this external.
Is it not now compatible with SC? That would save some work.


Better yet, I found it buried away, and is now attached. It runs in BundleBridge, so you should be able to run it if you force SC to run in Rosetta.

But, you can get in and look at the scripts, anyway.

For a quick glance, you have
Code: Select all
function WebKit_Start tWindow, tRect
on WebKit_Dispose webKitRef
on WebKit_setRect webKitRef, tRect
on WebKit_Focus webKitRef
on WebKit_Show webKitRef
on WebKit_Hide webKitRef
on WebKit_UnFocus webKitRef
on WebKit_LoadURL webKitRef, tURL
on WebKit_LoadSavedRequest webKitRef, tRequestRef
on WebKit_LoadHTML webKitRef, tHTML, baseURL
function WebKit_GetURL webKitRef
on WebKit_GoBack webKitRef
on WebKit_GoForward webKitRef
on WebKit_GoHistory webKitRef, relativePos
function WebKit_CanGoBack webKitRef
function WebKit_CanGoForward webKitRef
function WebKit_GetBackList webKitRef, maxCount
function WebKit_GetForwardList webKitRef, maxCount
on WebKit_Reload webKitRef
on WebKit_StopLoading webKitRef
function WebKit_GetProgress webKitRef
function WebKit_CanShowMIMEType mimeType
function WebKit_CanShowMIMETypeAsHTML mimeType
on WebKit_Cut webKitRef
on WebKit_Copy webKitRef
on WebKit_Paste webKitRef
on WebKit_Delete webKitRef
on WebKit_Undo webKitRef
on WebKit_Redo webKitRef
function WebKit_CanUndo webKitRef
function WebKit_CanRedo webKitRef
function WebKit_UndoActionName webKitRef
function WebKit_RedoActionName webKitRef
on WebKit_ClearUndos webKitRef
on WebKit_StartSpeaking webKitRef
on WebKit_StopSpeaking webKitRef
on WebKit_MakeTextSmaller webKitRef
on WebKit_MakeTextLarger webKitRef
on WebKit_SetTextSizeMultiplier webKitRef
on WebKit_FindText webKitRef, theNeedle, isForward, isCaseSensitive, doWrap
on WebKit_SetJavascriptEnabled webKitRef, isEnabled
on WebKit_SetJavaEnabled webKitRef, isEnabled
on WebKit_SetPluginsEnabled webKitRef, isEnabled
function WebKit_RunJavaScript webKitRef, javascriptCode
function WebKit_GetTitle webKitRef
function WebKit_GetSource webKitRef
function WebKit_GetDOMSource webKitRef
on WebKit_SetUserAgent webKitRef, uaString
on WebKit_SetEditable webKitRef, isEnabled
on WebKit_ReplaceSelectionWithHTML webKitRef, html
on WebKit_ReplaceSelectionWithText webKitRef, theText
on WebKit_SetAlignment webKitRef, alignStyle
function WebKit_Snapshot webKitRef
on WebKit_SetUserProperty webkitRef, propName, propValue
on WebKit_AppendUserProperty webkitRef, propName, propValue
on WebKit_DeleteUserProperty webkitRef, propName
function WebKit_GetUserProperty webkitRef, propName
function WebKit_MakeXMLTreeFromDOM webKitRef
on WebKit_Focus webKitRef

It's been a long time since I actually worked with this project, and I've learned a lot more about JavaScript and XML since then. Some of these that grab my eye are:

function WebKit_GetDOMSource webKitRef
on WebKit_SetJavascriptEnabled webKitRef, isEnabled
function WebKit_RunJavaScript webKitRef, javascriptCode
function WebKit_MakeXMLTreeFromDOM webKitRef

And, on top of that, the WebKit team has been very busy. There may be some really sweet goodies added to the core WebKit code that you can take advantage of in the long run. I'm sure you could get some help, if needed, from the good folks at webkit.org, as well.

To go hand-in-hand with WebKit_MakeXMLTreeFromDOM, I've included his XML External, Beta 1, which is a Core Foundation-based XML Parser. I'd have a "very high" interest in some XML external(s) being updated.

Dave.
Attachments
xml.zip
Old Tomas XML external. Runs in BundleBridge.
(43.47 KiB) Downloaded 524 times
WebKit.zip
Old Tomas WebKit external. Runs in BundleBridge.
(68.31 KiB) Downloaded 467 times
Last edited by Dave_Higgins on Wed Jan 21, 2009 6:16 pm, edited 1 time in total.
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Web View

Postby marksch » Tue Jan 20, 2009 12:31 pm

Hi Terry!

Thank you, it is great to see this external compiled as universal binary. Once finished, it will be extremely useful!

Best,

Mark
We have time for new projects. Contact me at http://qery.us/du now and be first in line.

Biggest free icon collection ever: http://icons.qery.us
User avatar
marksch
 
Posts: 78
Joined: Fri Aug 22, 2008 4:51 am

Re: Web View

Postby witness » Fri Jan 23, 2009 8:14 am

Just a tip: You're using Cocoa, so you can use SuperCard-like tricks to make it easier to implement some of these functions. I.e. all the IBAction functions are of the same form: -(void) goBack: (id)sender where the sender is generally ignored. So you can take the strings your XCMD gets as parameters and use NSSelectorFromString() to get a SEL, (the data type that @selector() returns) and then you can use [myWebView performSelector: theSel withObject: nil] or whatever to actually make the call. That way, you only need to write code for each kind of command, not for each one individually.

This is roughly equivalent to using value() or do in SC.

Of course, since Objective C is case-sensitive, you may want to use an NSDictionary to look up the right spelling for the commands. I.e.:

NSDictionary *possibleCommands = [NSDictionary dictionaryWithObjectsAndKeys: @"goBack:", @"goback", @"reload:", @"reload", nil];
NSString* lowercasedCommand = [myParameter lowerString];
NSString* caseCorrectedCommand = [possibleCommands objectForKey: lowercasedCommand];
if( caseCorrectedCommand == nil ) // unknown command passed to XCMD.
return; // TODO: Emit error message.
SEL theCommand = NSSelectorFromString(caseCorrectedCommand);
if( theCommand == nil ) // No selector of that name? Shouldn't be possible, except if our dictionary has a typo.
return; // TODO: Emit error message.
[myWebView performSelector: theCommand withObject: nil];

(code typed from memory, may contain typos)

To add a new command, all you have to do is add two simple list items to the dictionary declaration:
@"makeTextLarger:", @"maketextlarger",
for example.

One trick in the code above is the lowerString thing: NSDictionary is case-sensitive, but SuperCard isn't, so what I do is simply specify all the keys in the dictionary in lowercase. When I get a string from the user of the XCMD, I turn it into lowercase, which ensures that no matter whether the user wrote "GOBACK", "GoBack", "goBack" or "goback", I always get the dictionary entry with the key "goback" (in this case "goBack:").

Another advantage of the dictionary approach is that you verify that whatever string is passed in is one that you actually support. So if the user accidentally specifies "release" (e.g. passes in the wrong variable), your code won't end up prematurely releasing your myWebView object and cause the whole app to crash. It's a security advantage.

The same dictionary approach works for other stuff, too. A dictionary can contain any kind of object, so if you wrap a number in an NSNumber, you can have a dictionary that maps strings (like you get them from SuperCard as XCMD parameters) to numbers, and even numeric constants. A sample dictionary would look like:

NSDictionary *possibleInterpolations = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: NSImageInterpolationDefault], @"default", [NSNumber numberWithInt: NSImageInterpolationNone], @"none", [NSNumber numberWithInt: NSImageInterpolationLow], @"low", [NSNumber numberWithInt: NSImageInterpolationHigh], @"high", nil];
NSNumber* interpolationNumObject = [possibleInterpolations objectForKey: [myParameter lowerString]];
int myInterpolationNumber = NSImageInterpolationDefault;
if( const )
myInterpolationNumber = [interpolationNumObject intValue];
// use myInterpolationNumber here...

Such a dictionary is what is referred to in computer science texts as a "look-up table".
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are Everywhere..."
http://www.zathras.de
User avatar
witness
 
Posts: 57
Joined: Thu Jul 17, 2008 2:24 pm

Re: Web View

Postby sctell » Sat Jan 24, 2009 11:21 am

Uli,

Thank you for all the advice, you have given me a lot to think about.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby sctell » Sat Jan 24, 2009 11:28 am

Hi all,

I have not had much time over the last few days but have now updated the external.

It seems a lot more reliable now (famous last words).

I have implemented the following:

loadURLText
goBack
goForward
makeTextLarger
makeTextSmaller

Do not forget the init and release buttons.

The SCWebView obtains focus (SC loses it) when the mouse enters the view area and similarly when the mouse leaves the view SC regains focus.
I have not decided whether this is the best arrangement?

The external can be found here:
http://www.theaford.co.uk/Site/SC_Externals_files/SCWebViewTest.zip
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby bookbuzz » Sat Jan 24, 2009 1:26 pm

Thanks! As it now stands, this external meets the needs of my demo. As you know, I originally asked the question so I could display an embedded FlippinBook swf file. When WebView is open I still get the "cursor jumping" when I am over the Flash movie. However, the new version eliminates some residual "cursor jumping" (the cursor rapidly switching between the hand and the arrow) that persisted within SC after WebView was closed.

I can see many possible uses external.

Thanks again,

Bookbuzz
bookbuzz
 
Posts: 13
Joined: Tue Jan 13, 2009 3:54 pm

Re: Web View

Postby sctell » Sun Jan 25, 2009 12:20 am

Hi,

I had not noticed the cursor issue btose efore. It only seems to happen when you hover over a flash control.

I'll have to think about this one. I don't do anything to the cursor so it may be outside my control, will have to see.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby sctell » Sun Jan 25, 2009 12:31 am

Hi Uli,

I have thought about your suggestions and will give them a try in SCWebView.

I did not realise until I tried a few moments ago, that you do not even have to get the capitalisation correct for the external name when called from SC.

I am not sure that I actually like the idea of capitalisation being incorrect and the script still functioning. It would be better if SC corrected the spelling and displayed the syntax correctly and coloured but maybe that is for a future version. I like the Xcode way of it presenting the correct syntax as you type although I could see that this may annoy the professional programmers, like yourself.

I noted in some Apple documentation somewhere that an NSDictionary is not suitable for keys and value in excess of a few hundred.

Does the performance suffer when the look up table is larger?

Not that it applies to me but what is the way to implement a look up table of say 2000 items?

***** just edited this in SC *****
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby Dave_Higgins » Sun Jan 25, 2009 11:27 am

haden_young wrote:The SCWebView obtains focus (SC loses it) when the mouse enters the view area and similarly when the mouse leaves the view SC regains focus.
I have not decided whether this is the best arrangement?

At first, when reading this here in the forum, I thought "Yeah. That makes sense."... But then, when I brought up this forum in SCWebView and went to log in, I had moved the mouse cursor out of the way and went to type, but found I couldn't type into the user name field because SCWebView had lost focus. Once I moved the cursor back over SCWebView I could type again (the text insertion point was still in place).

I notice, also, that with a script window open, if the mouse cursor is over SCWebView then even the EnterKey will not trigger the OK button to close the script. Again, if scripted, I guess we could release focus to SC, edit the script, then allow SCWV to regain focus.

Sooooo. Maybe this does need some thinking over. I guess that should ultimately is should be left as a user option. I can't think of much outside of mouse clicks that a user might do that would require SC to regain focus (other than the script editing thing). But, then again, you may bump into a case where SCWebView has focus and the user wants to click on a SC button... If you let SCWV retain focus, are we going to find that it takes one click to give SC focus and then another click to actually click the button? That wouldn't be very good if you end up with no other choice. I guess experiments are in order.

Here's one for the back pocket... Not really a high priority, but one to look for as you stumble around in documentation... I was doing a little comparison of what SCWebView does vs. what Safari does with WebKit, and noticed that in SCWebView we don't get the dotted red underline for mis-spelled words. It would appear that it's something done in Safai instead of part of WebKit itself.

Another thing to consider in the medium run is cookies. Will SCWebView (or the project) keep it's own set or share with Safari? I guess there may be some options available to you as you move on... On one hand, the SC programmer might want to keep track of them on their own (each SC app could have it's own set, much like Safari and Firefox keep their own sets). On the other hand, a SC dev might want to share the Safari cookies.

Very nice start here. Keep up the good work.

Dave.
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Web View

Postby bookbuzz » Sun Jan 25, 2009 2:11 pm

Dave Higgins wrote: I can't think of much outside of mouse clicks that a user might do that would require SC to regain focus (other than the script editing thing). But, then again, you may bump into a case where SCWebView has focus and the user wants to click on a SC button...


This is exactly the case in my demo. Only part of the window is used for the SCWebView window, while the rest contains the same navigation used to move around in the multi-card application. At this point the user only interacts with the page-flipping FLASH movie, but would eventually need to be able to interact with a secure web-commerce page.

Bookbuzz
bookbuzz
 
Posts: 13
Joined: Tue Jan 13, 2009 3:54 pm

Re: Web View

Postby Dave_Higgins » Sun Jan 25, 2009 4:55 pm

Terry.

I know you're very early on with this, and I haven't seen an error yet, using your sample project. I'm wondering, however, what we can expect to see if an error does occur? I see that the calls you have so far are putting the function return value into cd fld 1 (which is always empty now). Just wondering if we should look for an empty result meaning all is OK and non-empty means error, or should we look for a line 1 of "false" and line 2 of error message?
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Web View

Postby Dave_Higgins » Sun Jan 25, 2009 6:39 pm

Oooh. Oooh. Oooh.

While browsing around, I came across a sample XCode project. When you get around to working out XML, I bet you can find some good ideas in /Developer/Examples/Foundation/XMLBrowser . Looks like Apple provides some XPath/XQuery tools for developers. I built and ran the sample app and it seems to cover a lot of stuff that really interests me.

With XML and XHTML being so closely related, some of these goodies might come in handy, like maybe one day being able to put SCWebView into a mode that will display the XPath to whatever you're mousing over, with the option to right-click and copy that path for including in JavaScript code. One of the biggest hurdles in learning JavaScript (for me, anyway) is nailing down the right path to an object that you want to manipulate. Something like that could come in pretty handy.

For anyone not sure what XPath/XQuery is, they have good examples at w3schools... http://www.w3schools.com/xquery/xquery_example.asp and http://www.w3schools.com/xpath/xpath_examples.asp .

An example of an XPath would be at Apple's main page, near the bottom, you find "Shop the Apple Online Store (1-800-MY-APPLE), visit an Apple Retail Store, or find a reseller." ....

The XPath to that would be:
/html[1]/body[1]/div[1]/div[6]/div[1]/p[1]
and the result would give you (as provided by the mentioned XML Browser app):
1: {
<p class="left">Shop the <a href="/store/">Apple Online Store</a> (1-800-MY-APPLE), visit an <a href="/retail/">Apple Retail Store</a>, or find a <a href="/buy/">reseller</a>.
</p>
}
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Web View

Postby Dave_Higgins » Sun Jan 25, 2009 7:53 pm

Another thing to look out for that I bumped into... Caching issues.

I had made some changes to a page involving CSS, AJAX JavaScript, and HTML. It looks like the JavaScript was not picking up on the changes to a <div> ID. I have notifications in place to alert me to the progress of the JS running, and it seemed to be running completely. The same changes were picked up in Safari with just a refresh.

I first tried loadURLText with limited success (it reflected the HTML changes, but the JS was not picking up on <div> renaming).
I then tried release / init and loading back up... Still no good (well, an onLoad JS call was making the call to my cgi, but the results were still not showing).
Then, with right-clicking around in SCWebView, when finally clicking in a blank area, I got a popup with "Reload" being the only option. This did the trick.

So, I guess you'll want to include some kind of Reload command that will do the same thing as this context-click menu item (which appears to be different than just simply re-running loadURLText).

[Edit]
Well, with some experimenting, it would appear that SCWebView is sharing cookies with Safari. It would also appear that:

  1. Reloading by way re-running loadURLText is the same as clicking in the address field of Safari and hitting enter.
  2. Reloading by way of the context-click item in SCWebView is the same as using either the context-click item or the reload button in the toolbar of Safari.
  3. When using method 1, the "HTTP_CACHE_CONTROL" header in the request is not sent along with a CGI call (it's an AJAX URL call that runs on pageLoad). When using method 2, the HTTP_CACHE_CONTROL" header is sent along. I think this has something to do with these caching oddities I'm seeing.

I realize that most of this will be beyond your control, and you're at the mercy of the WebKit tools provided, but I think it may demonstrate the need for a reload feature in the external to mimic the context-click reload, if possible.
[/Edit]
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Web View

Postby sctell » Mon Jan 26, 2009 12:54 am

Hi all,

I have implemented:
setFocusToSC
setFocusToWebView

I have this working. They will be in the next release. This will allow the user to decide what has focus.

Cookies:
It seems WebView uses NSHTTPCookieStorage

“NSHTTPCookieStorage implements a singleton object (shared instance) that manages the shared cookie storage. These cookies are shared among all applications and are kept in sync cross-process.”

You can add and omit and get a list. Implementing access to add,delete and get a list is someway down the road.

Errors:
There is in WebView a means to access errors. Will implement this, probably for the next update.

Hovering over a link to obtain the path.
If you right click on a link you can already copy the link to the clipboard. This is already built-in for free. At least the last time I tried it.

It will be possible to get the address of the current page via. script. This will probably be implemented in the next update.

Reload:
Will be in the next update. Trivial looking at the docs.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby marksch » Mon Jan 26, 2009 4:51 am

Hi Terry,

Is it possible/will it be possible to have mutliple browser windows open in one or more stack windows?

Best,

Mark
We have time for new projects. Contact me at http://qery.us/du now and be first in line.

Biggest free icon collection ever: http://icons.qery.us
User avatar
marksch
 
Posts: 78
Joined: Fri Aug 22, 2008 4:51 am

Re: Web View

Postby sctell » Mon Jan 26, 2009 5:52 am

Hi Mark,

Yes, I think it would be possible.

I have been thinking about this very thing for a number of my externals that reside in overlay windows. I have not tried it yet but it should be doable.

The question I think is to do with differentiating each overlay window when you call into the external.

Something like:

SCWebView("WebViewA","goBack")
SCWebView("WebViewB","goForward")

With regard to SCWebView I would like to first add more functionality into the external before trying to add this feature.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby Dave_Higgins » Mon Jan 26, 2009 8:22 am

haden_young wrote:SCWebView("WebViewA","goBack")
SCWebView("WebViewB","goForward")

With regard to SCWebView I would like to first add more functionality into the external before trying to add this feature.


For those of us who've used externals by Tomas, that's what he did with most of his, and it didn't seem much of a problem. SQLite, for example, works just fine with a hit-and-run approach (open, run, close in one handler, keeping the ref number in a local var). For those that need to reside long beyond idle (like SCWebKit and SCImageKit), there's little choice but to keep track of our own globals for ref numbers.

For the back pocket (you are keeping a list of to-do items, right :) ), when you do get around to it, it would be nice to be able to:
  • Retrieve a list of current/active ref numbers/names, and perhaps send back a particular error if a ref number is invalid, since users are likely to end up passing bad references when we are tracking our own.
  • Have a way to release all references in one shot (releaseAll).
  • Send a message when an object is released. If a reference is released unexpectedly (a script flaw causes a handler to run that wasn't expected to be run) a handler could be set up (on refReleased tRef) to make sure we remove the reference from our global (or whatever mechanism is used to store the reference (userProp, field, etc...))

haden_young wrote:setFocusToSC
setFocusToWebView

How about setFocusToAuto, which would leave the focus decision the way it is now? Or, at least send a message like mouseEnter and mouseLeave, so we can do this ourselves (perhaps after checking on future features, like if a text field in WebView is currently active or not).

haden_young wrote:Cookies:
You can add and omit and get a list. Implementing access to add,delete and get a list is someway down the road.

Sweet. This will come in handy for developing web sites that deal with adding/deleting cookies. Instead of having to dig into the cookie editor in Safari's prefs. Again for the back pocket, how about taking a look (when you're into the docs) to see if you can be notified of changes in NSHTTPCookieStorage, which in turn could send SC a message telling of the change in a cookie (add/modify/delete). Even if you can only be notified of any/all changes we could make our own filter to see if we're interested or not (does it belong to our site that we're working on?). If it's possible to narrow down to a particular cookie name or site, all the better. :)

haden_young wrote:Errors:
There is in WebView a means to access errors. Will implement this, probably for the next update.

I'm sure that won't be tough. Only thing I can think of here is to maybe differentiate WebView errors from your own error messages generated by the external. That is if an error message is sent to the project, as opposed to querying for an error.

Now that I look over the docs for SCImageKit, I guess these might end up having to be handled similar to SCIK_selectionDidChange, where a global is set by the external and checked on idle. However, I have a feeling that in some instances an actual message being sent to SC might be more appropriate for WebView, if that is possible for this type of external. Will have to wait for any particular examples.

haden_young wrote:Hovering over a link to obtain the path.
If you right click on a link you can already copy the link to the clipboard. This is already built-in for free. At least the last time I tried it.

Again in the long run, it would be nice to be able to handle all of the items in a context-click within WebView (Open link in new window, Download linked file, Open image in new window, etc...). Even just a message passed with the details (clicked object, url of link, etc...) would be fine so we can decide if we want to actually act on it or not.

haden_young wrote:Reload:
Will be in the next update. Trivial looking at the docs.

Wow. Speaking of looking through the docs... I just took a look at the WebView/WebKit docs. Looking down the list in the WebView Class Reference, there's a boatload of goodies there. I could easily come up with a long, long list of requests :o , but I'll hold off for now 8-) . The only new thing (not yet mentioned) I can think of to look at right away would be page load progress. Some basic (or detailed, if it's easy enough) load progress messages would be a real jam.

Again, thanks a million for working on this.
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Web View

Postby bookbuzz » Thu Jan 29, 2009 2:22 pm

The SCWebView.bundle works perfectly when I run the SC project. However, when I package it as an application or SC Player proejct I get this error: "Never heard of that function."

Does an external not go in the same Resources package folder as the other resources?

Thanks in advance for help.

BookBuzz
bookbuzz
 
Posts: 13
Joined: Tue Jan 13, 2009 3:54 pm

Re: Web View

Postby sctell » Fri Jan 30, 2009 12:53 am

Hi BookBuzz,


Yes, you install the external as per other externals.

Please note however the project script in the example:

Code: Select all
on openProject
open window "anchor"
open window "SCWebView"
--These 3 lines are only required for my testing
put projectPath(this project) & "SCWebView.bundle" into bundlePath
put bundlePath into cd fld 1 of window "SCWebView"
load external bundlePath
end openproject


If you have this script installed it needs to be changed to remove these 3 lines:
Code: Select all
put projectPath(this project) & "SCWebView.bundle" into bundlePath
put bundlePath into cd fld 1 of window "SCWebView"
load external bundlePath


I hope this answers your question.

Please note however that the external has not been fully tested although it may do what you want.

In addition I intend to change the syntax arrangement as a result of the requests to allow more than one SC window to contain a different WebView and also to allow more than one WebView to be attached to a SC window.

The syntax in future will entail:

Returning a reference to a WebView when it is first created. SC will have to keep track of this in a global.
Something like gWebView_A, gWebView_B but upto the scripter.

Then when you call into the external it will be something like this:

SCWebView("wd id 100",gWebView_A,"goBack")

I nearly have this sorted and would be hoping to make a further post this weekend.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby bookbuzz » Fri Jan 30, 2009 5:37 am

haden_young wrote:Yes, you install the external as per other externals.


Forgive me for my confusion. Where is there clear, step-by-step documentation on how to install an external? From what I've read, it should be installed in the data fork of the project before packaging. Isn't the Resource Manager the tool for this? But the SCWebView.bundle doesn't open in the RM.

Is there a reason SC can't make it work just as it does in the project so it can easily be put in and out of the package Resource folder with everything else?

BookBuzz
Last edited by bookbuzz on Fri Jan 30, 2009 8:21 am, edited 1 time in total.
bookbuzz
 
Posts: 13
Joined: Tue Jan 13, 2009 3:54 pm

Re: Web View

Postby bmartin » Fri Jan 30, 2009 6:16 am

In SuperEdit you have to use the Import Bundle External... from the file menu. This will import the needed resources into a new project from there you can move as needed in the usual ways. Since this is still in development I wouldn't expect it to be delivered in the traditional manor because building an app with this external may lead to issues that are unseen right now. So if you don't have SE you muse wait.
Bruce Martin

Mac Os 10.6.3
2.8 Ghz Intel Core 2 Duo
4GB 1067 MHz DDR3
User avatar
bmartin
 
Posts: 149
Joined: Mon Jul 07, 2008 7:26 am
Location: Stroudsburg, PA

Next

Return to XCmds, XFcns, and XRtns

Who is online

Users browsing this forum: No registered users and 1 guest

cron