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

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
madamefeemy
Posts: 3
Joined: Sat Apr 25, 2015 6:53 am

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

Post by madamefeemy » Sat Apr 25, 2015 6:57 am

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!

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

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

Post by Mark » Sat Apr 25, 2015 10:28 am

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

SparkOut
Posts: 2961
Joined: Sun Sep 23, 2007 4:58 pm

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

Post by SparkOut » Sat Apr 25, 2015 10:33 am

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.

madamefeemy
Posts: 3
Joined: Sat Apr 25, 2015 6:53 am

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

Post by madamefeemy » Sat Apr 25, 2015 3:41 pm

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.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

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

Post by Mark » Sat Apr 25, 2015 4:07 pm

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
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply