Web View

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

Re: Web View

Postby sctell » Sun Nov 03, 2013 12:23 am

KevinPaszalek wrote:Is it possible to trap for returnInField in WebView?


I am not sure what you are asking:

I placed this

Code: Select all
on returnInField
beep
end returnInField


in the instructions field in the test project and it worked.

Also returnInField is contained in the script for URL field in the same project.

I think I must be misunderstanding your question, can you elaborate please.

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby KevinPaszalek » Sun Nov 03, 2013 3:11 pm

Thanks, Terry. I was too vague.
Here's what I want to do:
I want to allow the user to be able to select the next line of text in the WebView by hitting return. That is, one can go through an entire web page line by line just by hitting return.
Is that possible?
Thanks very much!
K
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby sctell » Tue Nov 05, 2013 6:50 am

Hi,

I have just uploaded an update which now incorporates a test for the return key being pressed when the web view has the focus.

It is called by adding an idle script:

Code: Select all
on idle
global SCWV_returnKey

if SCWV_returnKey = "true" then
beep
put "false" into SCWV_returnKey
end if

end idle


I hope this helps.

The update can be found in the first post of this thread.

I will give a little thought to selecting a line of text, this sounds difficult because a web page can have many frames. I don't think you can even do this in Safari?

You can capture all the text on a web page and return it to SC.

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby sctell » Tue Nov 05, 2013 7:03 am

Thinking about the issue I just tried this script:


Code: Select all
on idle
global SCWV_returnKey
global gWebView

if SCWV_returnKey = "true" then
put SCWebView("copy","wd id 100",gWebView) into tInfo
put "" into cd fld 1
select after text of cd fld 1
paste text without style

put "false" into SCWV_returnKey
end if

end idle


This requires the text to be selected prior to pressing the return key and does not allow automatic selection of text.


--Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby KevinPaszalek » Thu Nov 07, 2013 7:49 am

Terry, thanks so much for taking your time to think about this with me!
Blessings,
Kevin
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby sctell » Thu Nov 07, 2013 12:09 pm

Kevin,

I am hoping this does what you want. The new external is contained in the first post of this thread.

It contains the following new commands:

moveToBeginningOfSentence
moveToBeginningOfSentenceAndModifySelection
moveToEndOfSentence
moveToEndOfSentenceAndModifySelection
selectSentence
deleteSelection
makeEditable


It is necessary to use makeEditable for the functions to work correctly.

put SCWebView("makeEditable","wd id 100",gWebView,"true") into tInfo -- true or false

and the rest are simply

put SCWebView("moveToEndOfSentence","wd id 100",gWebView) into tInfo

Let me know how you go on.

--Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby sctell » Thu Nov 07, 2013 11:59 pm

sctell wrote:put SCWebView("makeEditable","wd id 100",gWebView,"true") into tInfo -- true or false


Just noticed that I had previously incorporated "setEditable" in this external.

Both "makeEditable" and "setEditable" do the same thing, so use either.


--Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby witness » Sat Nov 09, 2013 4:48 am

sctell 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?


I know I'm a bit late, but I only just saw this and thought I'd offer an idea: You could make this view "replace" a text field. I.e. "init" would take an object descriptor like "cd fld 7" and use that field's rectangle. It would also modify the field's script and properties. When someone tabs into the field, it would tell the Web View to focus. When someone tabs out of the web view (I hope there's a way to detect this), it would put focus on the next field after the field it replaced using a quick SendHCMessage() or whatever callback.

That way, SC would tell you when to gain focus and when to lose it. Also, of course, when someone clicks your Web View, you would take focus away from SuperCard.

If you want to make it especially easy to use, you could even make sure you edit the openField handler in the field but don't touch any other handlers. Then your XCMD would send all its messages to the field, and users could react to events in the web view by simply implementing handlers in it. It would almost feel like a "field style".
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 Nov 09, 2013 6:30 am

Hi Uli,

Nice to here from you again.

Entering and leaving a field can be accomplished by:

Code: Select all
on openField
beep
put "entered " & the target
end openField

on leaveField
beep
put "left " & the target
end leaveField


I have not looked into the WebView yet put I would be surprised if you cannot pick up a tab key event.

This idea would on the face of it be a solution to maintaining focus between Cocoa based overlay windows and SC and warrants an experiment or two.

I did produce an overlay window external some time ago based on a NSTableView and if this idea works then perhaps it could be used to good effect with that.

You keep coming up with these ideas that regenerates my interest in externals. ;)

All the best

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby sctell » Sat Nov 09, 2013 8:35 am

Interesting,

I have been playing and cannot get my WebView to identify a tab when I override keyDown.

I am not sure but think it may have something to do with this statement in apples event guide.

Some objects found on Interface Builder palettes do not participate in keyboard interface control, such as NSImageView, WebView, and PDFView objects.



These are the interface control elements:

Tab - Move to next key view.
Shift-Tab - Move to previous key view.
Space - Select, as with mouse click in a check box (for example), or toggle state. In selection lists, selects or deselects highlighted item.
Arrow keys - Move within compound view, such as NSForm objects.
Control-Tab (Control-Shift-Tab) - Go to next (previous) key view from views where tab characters have other significance (for example, NSTextView objects).
Option or Shift - Extend the selection, not affecting other selected items.


This idea may well be scuppered unless I am misunderstanding.

Any ideas?

Thanks

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby sctell » Sat Nov 09, 2013 12:07 pm

sctell wrote:I have been playing and cannot get my WebView to identify a tab when I override keyDown.


I have found a way around this and it involves the use of a private function

setTabKeyCyclesThroughElements


If I

Code: Select all
[myWebView setTabKeyCyclesThroughElements:NO];


This turns off the action of the tab key in the web view itself but allows its pressing to be detected by keyDown as per normal keyboard action.

This really does not seem the answer because it would mean losing the tab key in the web view.

Still looking for a solution?

--Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby KevinPaszalek » Mon Nov 11, 2013 5:58 am

sctell wrote:I am hoping this does what you want. The new external is contained in the first post of this thread.

Terry, you are amazing! Thanks a lot. I will let you know how this works.
Blessings!
Kevin
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby marksch » Mon Nov 11, 2013 12:23 pm

Hi,

I tried the WebView external a long time ago. Back then, it worked within Rosetta only and only partially. Can I use it with SuperCard 4.6 while running SuperCard natively on an Intel machine?

Kind regards,

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 » Thu Nov 14, 2013 12:20 am

marksch wrote:Hi,

I tried the WebView external a long time ago. Back then, it worked within Rosetta only and only partially. Can I use it with SuperCard 4.6 while running SuperCard natively on an Intel machine?

Kind regards,

Mark


Hi Mark,

This external has always been intel as it is based upon a Cocoa overlay window that floats above the SC window and is grouped using the Carbon group routines so it moves with the Carbon SC window.

Do you still use SC, I thought you moved to LiveCode years ago?

All the best

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: trapping a return key in the WebView

Postby KevinPaszalek » Tue Nov 19, 2013 9:37 pm

Dear Terry,
I have the following idle code which attempts to implement a selecting of a sentence when the return key is pressed.
However, the code is never called. It seems that no idle messages are sent.
I'm just not sure what to do.
Thanks,
K


Code: Select all
on idle
global SCWV_frameLoaded, gWebView, SCWV_returnKey

if SCWV_frameLoaded is true then
put SCWebView("mainFrameURL","wd id 100",gWebView) into tInfo
put tInfo into cd fld 2
--    put "frame loaded" & return after cd fld 1
put false into SCWV_frameLoaded
end if

if SCWV_returnKey = "true" then
put SCWebView("selectSentence","wd id 100",gWebView) into tInfo
put "false" into SCWV_returnKey
end if
pass idle
end idle
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby sctell » Wed Nov 20, 2013 11:08 am

KevinPaszalek wrote:I have the following idle code which attempts to implement a selecting of a sentence when the return key is pressed.
However, the code is never called. It seems that no idle messages are sent.
I'm just not sure what to do.


Hi Kevin,

Having checked my code there were a few issues but I believe I have now sorted it out.

What I need to know is your requirements.

I can now detect the enter key being pressed in the web view and return that to SC.

What happens is.

1. The code reads the event.
2. Checks to see if it is the enter key.
3. if it is the enter key the code has two options:
(a) If it returns nil the event is not processed
(b) If it returns the event the event is processed by the web view.
4. The code in both cases above informs SC that the enter key has been pressed.

This obviously affects what happens in the window when you are selecting sentences.

If I have the event processed by the web view (3b) when you press the enter key it will be processed if you have setEditable set to true (the enter key will not be ignored and SC will be informed).

If I have the event ignored by the web view (3a) when you press the enter key it will not modify the text if you have setEditable set to true (the enter key will be ignored and SC will be informed).

I hope this is clear.

Perhaps you would let me know your preferred option or perhaps I could incorporate another routine to set it to one or the other.

Perhaps ignoreEnterKey with true or false.

I await your reply.

All the best

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby KevinPaszalek » Fri Nov 22, 2013 5:04 am

Dear Terry,
Thank you for all the attention you have given to this. Let me set my requirements in context.
My program is a tool for quickly categorizing information from files and websites. To accomplish this, it has one nonstandard behavior: in order to move through a file quickly, the user simply hits the return key to automatically select the next entire paragraph. When the user gets to a paragraph with information he/she wants, he/she processes it, then goes back to hitting return to move through the document a paragraph at a time. For this purpose it is more efficient than scrolling.

I want the user to be able to do the same thing in the webview: move through a web page selecting one paragraph at a time by hitting the return key.

I hope that's a little clearer.

Thanks again for your time and attention!

Blessings,
Kevin
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby sctell » Fri Nov 22, 2013 6:58 am

Hi Kevin,

I have just posted an update, hopefully you can get it to do what you want.

I have added one new command:

Code: Select all
put SCWebView("ignoreEnterKey","wd id 100",gWebView,"true") into tInfo


If you pass true then the external when in editing mode via.

Code: Select all
put SCWebView("setEditable","wd id 100",gWebView,"true") into tInfo


will ignore the enter key but let SC know the enter key has been pressed.

Give it a try.

If we get it to work there are many, many commands available. Here are a few that you may find useful. If you let me know which ones after we have the basics right then I will implement them.

– moveBackward:
– moveBackwardAndModifySelection:
– moveParagraphForwardAndModifySelection:
– moveParagraphBackwardAndModifySelection:
– moveToBeginningOfDocumentAndModifySelection:
– moveToEndOfDocumentAndModifySelection:
– moveToBeginningOfLineAndModifySelection:
– moveToEndOfLineAndModifySelection:
– moveToBeginningOfParagraphAndModifySelection:
– moveToEndOfParagraphAndModifySelection:
– moveToLeftEndOfLine:
– moveToLeftEndOfLineAndModifySelection:
– moveToRightEndOfLine:
– moveToRightEndOfLineAndModifySelection:
– moveDown:
– moveDownAndModifySelection:
– moveForward:
– moveForwardAndModifySelection:
– moveLeft:
– moveLeftAndModifySelection:
– moveRight:
– moveRightAndModifySelection:
– moveToBeginningOfDocument:
– moveToBeginningOfLine:
– moveToBeginningOfParagraph:
– moveToEndOfDocument:
– moveToEndOfLine:
– moveToEndOfParagraph:
– moveUp:
– moveUpAndModifySelection:
– moveWordBackward:
– moveWordBackwardAndModifySelection:
– moveWordForward:
– moveWordForwardAndModifySelection:
– moveWordLeft:
– moveWordRight:
– moveWordRightAndModifySelection:
– moveWordLeftAndModifySelection:


Good luck

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby KevinPaszalek » Fri Nov 22, 2013 2:15 pm

Wow, Terry!
However, I am uncertain now about a couple of things:
1. Is the enter key synonymous with the return key?
2. Do I need to still use SCWV_returnKey or just use On EnterKey?
Thanks
K
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby sctell » Fri Nov 22, 2013 11:50 pm

Hi Kevin,

I currently have the external working as follows:

In the idle script:

Code: Select all
if SCWV_returnKey = "true" then
put SCWebView("moveToEndOfSentence","wd id 100",gWebView) into tInfo
put SCWebView("selectSentence","wd id 100",gWebView) into tInfo
put "false" into SCWV_returnKey
end if


This seems to work when I have used the following:

Code: Select all
put SCWebView("ignoreEnterKey","wd id 100",gWebView,"true") into tInfo


and

Code: Select all
put SCWebView("setEditable","wd id 100",gWebView,"true") into tInfo



ignoreEnterKey and setEditable only need to be called once and not knowing your setup would suggest they go wherever you are using.

Code: Select all
put SCWebView("createWebView","wd id 100",tLeft,tTop,tWidth,tHeight) into gWebView


A little mistake with regard to ignoreEnterKey, I should have named it ignoreReturnKey.

I will change this at the next update.

All the best

Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby KevinPaszalek » Sun Nov 24, 2013 6:04 pm

Thanks, Terry! I'm eager to try it out.
Blessings,
Kevin
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby KevinPaszalek » Tue Dec 03, 2013 11:10 am

Terry, do you have an idea of when you will be able to work on this?
I'm just trying to plan my work.
Blessings,
Kevin
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby sctell » Wed Dec 04, 2013 2:23 am

Kevin,

Have you tried the last update? I believe it works?

Did it work as you require?

If yes, I will update again to change ignoreEnterKey to ignoreReturnKey.

Do you require any of the additional functions I mentioned in the earlier post?
If you do only specify those you are really interested in.

--Terry
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby KevinPaszalek » Thu Dec 05, 2013 5:03 am

Dear Terry,
Thanks. I'm sorry. I didn't try the last version because I wasn't even sure how to type Enter! (Fn-Return, I think I discovered.) Also, I somehow thought that you were going to do the new version right away.
I will try it this week and get back to you.
As far as I can see now, I don't need any of the other capabilities in the most recent list you gave me.
Blessings,
Kevin
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby KevinPaszalek » Fri Dec 06, 2013 8:30 pm

Dear Terry,
This works great! All I need are these four calls:

moveForward
moveParagraphForwardAndModifySelection
moveToBeginningOfParagraph
moveToEndOfParagraphAndModifySelection

I will call that from the existing idle code that you wrote.
Thanks again so much!
Blessings,
K
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

PreviousNext

Return to XCmds, XFcns, and XRtns

Who is online

Users browsing this forum: No registered users and 1 guest

cron