Page 1 of 1

I want to enter url in field & have browser open in graphic

Posted: Sat Apr 25, 2015 6:57 am
by madamefeemy
I would like to be able to type a url into a field, press enter, and have the specified url pop up in a specified region of the screen. Any advice or direction to instructions on this topic would be much appreciated.

Thanks!

Re: I want to enter url in field & have browser open in grap

Posted: Sat Apr 25, 2015 10:28 am
by Mark
Hi,

What have you tried so far?

Here's an example:

Code: Select all

put revOpenBrowser(the windowID of this stack,fld "Url") into gBrowserID
if gBrowserID is an integer then
  revBrowserSet gBrowserID,"rect",the rect of grc "My Graphic"
else
  beep
  answer error gBrowserID
  put empty into gBrowserID
end if
Kind regards,

Mark

Re: I want to enter url in field & have browser open in grap

Posted: Sat Apr 25, 2015 10:33 am
by SparkOut
If you open the Resource Centre from the menu bar in the LiveCode IDE (or whatever alternative method) if you expand the Tutorials section with the disclosure triangle, and the same with the Internet section, you will see a Browser Sampler, which you can investigate and make sure you have understood what Mark said.

Re: I want to enter url in field & have browser open in grap

Posted: Sat Apr 25, 2015 3:41 pm
by madamefeemy
Thank you for the replies!

Re: Mark

I made a card with a field named "Url" and graphic named "My Graphic." Then, I tried putting the code you suggested into the code of the overcall card (I'm not sure what the proper term is - I just mean the window when no specific buttons or fields are selected).

Code: Select all

put revOpenBrowser(the windowID of this stack,fld "Url") into gBrowserID
if gBrowserID is an integer then
  revBrowserSet gBrowserID,"rect",the rect of grc "My Graphic"
else
  beep
  answer error gBrowserID
  put empty into gBrowserID
end if
But nothing happened. I'm definitely not doing something correctly, but I'm not sure what. Am I supposed to input this as the code for the field, or for the overall card?


Re: SparkOut

I tried playing around with the sample browser, but when I looked at the code of the url bar/field, it said the following

Code: Select all

on returnInField
  gourl
end returnInField

on enterInField
  gourl
end enterInField

on gourl
  abLoadURL me
end gourl
I'm not sure what "abLoadURL me" means, nor how this directs the website to display in a specific graphic. The code of the overcall card has nothing input either.

Re: I want to enter url in field & have browser open in grap

Posted: Sat Apr 25, 2015 4:07 pm
by Mark
Hi Madamefeemy,

I suggest you read the documentation, the tutorials, the lessons and perhaps my book.

Regarding programming, start with making a new button on a card of a stack and give it the following script:

Code: Select all

on mouseUp
  answer "Hello World"
end mouseUp
That should give you a minimal understanding of how things work and hopefully enough to know what to look for in the documentation.

Kind regards,

Mark