Web View

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

Re: Web View

Postby sctell » Fri Dec 06, 2013 11:48 pm

Kevin,

KevinPaszalek wrote:This works great! All I need are these four calls:

moveForward
moveParagraphForwardAndModifySelection
moveToBeginningOfParagraph
moveToEndOfParagraphAndModifySelection


I am away for a couple of days, will update and post on Monday, I am GMT.

All the best
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Web View

Postby sctell » Mon Dec 09, 2013 2:59 am

Hi Kevin,

KevinPaszalek wrote: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


I have now amended the external and it can be found in the first post.

We now have the following functions related to your original request:


ignoreReturnKey -- modified from ignoreEnterKey
moveForward
setEditable -- makeEditable now deleted from the external

deleteSelection

selectParagraph
moveParagraphForwardAndModifySelection
moveToBeginningOfParagraph
moveToEndOfParagraphAndModifySelection

selectSentence
moveToBeginningOfSentence
moveToBeginningOfSentenceAndModifySelection
moveToEndOfSentence
moveToEndOfSentenceAndModifySelection


Please try out and advise me if it needs any further modification.

All the best

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

Web View- an odd thing

Postby KevinPaszalek » Wed Dec 11, 2013 9:21 pm

Terry,
I have a Find... menu item that opens a Find window over another SC window. The window is opened in response to a menu command or Cmd-F.

After I have clicked in the webview viewRect (e.g., selected some text) the program is sometimes unable to open the Find window from the keyboard. I type Command-F and the menu flashes, but the Find window does not appear and the program beeps.

Two things will change this situation: clicking on the menu and selecting "Find..." or clicking on the title bar of the webview window.

I suspect that this has something to do with focus, but I am not sure.

Any ideas?

Thanks for your help!
Blessings,
Kevin
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby sctell » Thu Dec 12, 2013 8:28 am

KevinPaszalek wrote:I suspect that this has something to do with focus, but I am not sure.

Any ideas?


The WebView is actually a Cocoa window with Cocoa events placed on top of the SC window so you are correct, the WebView window is getting different events than the SC Window.

I have now implemented a function within the external to modify a SC global when command F has been pressed.

The script should be in the idle handler as the others:

Code: Select all
global SCWV_cmdF
if SCWV_cmdF = "true" then
put "cmdF" & return after cd fld 1
put "false" into SCWV_cmdF
end if


It seems to work.

The update is in the first post of this thread as usual :)

All the best

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

Re: Web View

Postby KevinPaszalek » Thu Dec 12, 2013 10:43 pm

Terry,
You are amazing!
Thanks so much for this. I will try it out as soon as possible.
You know, I traveled through London half a dozen times before I realized that Greenwich was just on the other side of the river. Americans!
I'll let you know how it goes.
Blessings,
Kevin
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby KevinPaszalek » Mon Dec 16, 2013 10:48 pm

Terry,
The command- F fix works great! Thank you!
However, there is a problem with the return key feature. The idle script for SCWV_returnKey never gets called.

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


The selection in WebView is replaced rather than deselected and the insertion point moved to the beginning of the next paragraph.
SetEditable is set to true.
Any ideas?
Thanks,
K
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby sctell » Mon Dec 16, 2013 11:48 pm

KevinPaszalek wrote:Terry,
The command- F fix works great! Thank you!
However, there is a problem with the return key feature. The idle script for SCWV_returnKey never gets called.

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


The selection in WebView is replaced rather than deselected and the insertion point moved to the beginning of the next paragraph.
SetEditable is set to true.
Any ideas?
Thanks,
K



Kevin,

It works for me. Don't forget you have to implement this code snippet before you use the paragraph routines. It is better not in the idle script.

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


If you don't call this the return is processed by the WebView just as in a text editor and the highlighted text is deleted. "ignoreReturnKey" instructs the WebView NOT to process the return key as in a text editor but to ignore it, if you pass it true.

So, to summarise:

ignoreReturnKey, "true" -- tells the WebView NOT to process the return key as a text editor would
ignoreReturnKey, "false" -- tells the WebView to process the return key.

All the best

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

Re: Web View

Postby KevinPaszalek » Tue Dec 17, 2013 6:55 am

Congratulations, Terry! You did it!
Your diagnosis was correct. I had left that code snippet out somehow.
Thank you so much for your efforts on my behalf.
Blessings,
Kevin
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby KevinPaszalek » Thu Dec 19, 2013 8:02 pm

Dear Terry,
Unintended consequences: The user can't type a return in a text box on a web page. This may not be that big a problem for most users. They can just click the button on a Google search field for instance.
Otherwise things are working well.
Blessings,
K
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby sctell » Fri Dec 20, 2013 1:36 am

KevinPaszalek wrote:Dear Terry,
Unintended consequences: The user can't type a return in a text box on a web page. This may not be that big a problem for most users. They can just click the button on a Google search field for instance.
Otherwise things are working well.
Blessings,
K


At the moment I can't think of a solution for this because that is the intention of:

ignoreReturnKey, "true" -- tells the WebView NOT to process the return key as a text editor would
ignoreReturnKey, "false" -- tells the WebView to process the return key.


This may or may not be relevant to what you want to achieve but I think it would be possible to have two additional functions:

SCWV_keyPressed -- a key has been pressed, the key code (number)
SCWV_cmdKeyPressed - a key has been pressed, the key code (number), with the cmd key

You would then be able to implement something like:

Code: Select all
global gIgnoreRetKey -- (set to "true" elsewhere to match call to the external)

if gIgnoreRetKey = "true" then

  if SCWV_keyPressed = 36 -- 36 is the return key
  --do something
  end if

  if SCWV_cmdKeyPressed = 36 then
  --do something else
  end if

end if



I could have the cmdKey + Keypress behave normally in the external when ignoreReturnKey = "true"
So cmdKey + returnKey would process the return key as a text editor.

So with your example the Google search field would function as normal if the cmdKey + return were pressed together.

Let me know what you think. Will this help your predicament.


All the best

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

Re: Web View

Postby KevinPaszalek » Sat Dec 21, 2013 9:41 pm

Terry, I believe this would work. I do something like this already on another card where the user has to type option-Return to insert a return in a field.
Thanks!
K
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby sctell » Sun Dec 22, 2013 10:25 am

Hi Kevin,

I have posted an update. As usual it's in the first post of this thread.

If you have

setEditable set to true
ignoreReturnKey set to true

and you type in Googles search box then press cmd+return the search proceeds as normal.

I have also added these two globals:

SCWV_cmdKeyCode -- the key code for the key pressed with the cmd key
SCWV_keyCode -- the key code for the key pressed

They may be useful for something.

Code: Select all
if SCWV_cmdKeyCode is not empty then
-- do something
put "SCWV_cmdKeyCode = " & SCWV_cmdKeyCode & return after cd fld 1
put empty into SCWV_cmdKeyCode
end if

if SCWV_keyCode is not empty then
--do something
put "SCWV_keyCode = " & SCWV_keyCode & return after cd fld 1
put empty into SCWV_keyCode
end if


All the best

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

Re: Web View

Postby KevinPaszalek » Sun Dec 22, 2013 8:12 pm

You, my friend, are amazing! Most of our kids and grandkids are gathered for Christmas. I will try this out as soon as I can and let you know how it works.
Blessings and Merry Christmas.
Kevin
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby sctell » Mon Dec 23, 2013 11:11 am

KevinPaszalek wrote:Most of our kids and grandkids are gathered for Christmas. I will try this out as soon as I can and let you know how it works.


We are in a similar situation however:

My daughter, son-in-law and grand children live in the same street 100m.
My other son lives 500m away.

So they are here, all the time. ;)

Have a very Merry Christmas

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

Re: Web View

Postby KevinPaszalek » Fri Dec 27, 2013 9:00 am

Terry, this works! thank you so much!
I hope you had a wonderful Christmas.
Kevin
KevinPaszalek
 
Posts: 105
Joined: Fri Jun 08, 2012 11:35 am

Re: Web View

Postby sandrobilbeisi » Tue Dec 05, 2017 12:47 am

Does anyone know wether the SCWebView external allows JavaScript to call back into the SuperCard window ?
sandrobilbeisi
 
Posts: 34
Joined: Mon Dec 04, 2017 1:11 am

Previous

Return to XCmds, XFcns, and XRtns

Who is online

Users browsing this forum: No registered users and 1 guest

cron