Page 1 of 1

Browsing field

Posted: Mon Jul 04, 2011 6:17 am
by cybernaut
Hello, I have created a field on my stack and I trying to fill it with a webpage from the internet.
I have tried anything to bring the webpage to show it in that field I created but nothing it is working.
Anybody can help me? I am sure that probably the solution is pretty easy but I am new at this.
I am using this on a button:

on mouseUp
put URL "http://www.abc.net/" into Field "WebField"
end mouseUp

But the field does not resolve the URL, only giving me the html source code!!
Thank you
Herman

Re: Browsing field

Posted: Mon Jul 04, 2011 9:23 am
by shaosean
You will probably want to look at the revBrowser features, but here is a quickie script

1. create an image control, call it "browserRect", set the dimensions to whatever you want
2. create a button, add this script

Code: Select all

on mouseUp
  local tBrowserID
  put revBrowserOpen(the windowID of this stack, "http://www.abc.net/") into tBrowserID  // creates a revBrowser instance and navigates to the website
  revBrowserSet tBrowserID, "rect", (the rect of image "browserRect")  // sets the dimensions of the browser instance to the dimensions of the image
end mouseUp
3. ???
4. profit

Re: Browsing field

Posted: Mon Jul 04, 2011 10:53 am
by cybernaut
shaosean wrote:You will probably want to look at the revBrowser features, but here is a quickie script

1. create an image control, call it "browserRect", set the dimensions to whatever you want
2. create a button, add this script

Code: Select all

on mouseUp
  local tBrowserID
  put revBrowserOpen(the windowID of this stack, "http://www.abc.net/") into tBrowserID  // creates a revBrowser instance and navigates to the website
  revBrowserSet tBrowserID, "rect", (the rect of image "browserRect")  // sets the dimensions of the browser instance to the dimensions of the image
end mouseUp
3. ???
4. profit
THANK YOU!!!!!!!!
This was exactly what I wanted!
I never knew about this revBrowser I have to study the dictionary. I am new to all this.
Again, thank you!!
Herman

Re: Browsing field

Posted: Mon Jul 04, 2011 11:35 am
by cybernaut
shaosean wrote:You will probably want to look at the revBrowser features, but here is a quickie script

1. create an image control, call it "browserRect", set the dimensions to whatever you want
2. create a button, add this script

Code: Select all

on mouseUp
  local tBrowserID
  put revBrowserOpen(the windowID of this stack, "http://www.abc.net/") into tBrowserID  // creates a revBrowser instance and navigates to the website
  revBrowserSet tBrowserID, "rect", (the rect of image "browserRect")  // sets the dimensions of the browser instance to the dimensions of the image
end mouseUp
3. ???
4. profit
I have successfully created a button to launch the website but what about if I want the website to automatically open when stack open? I have tried the same code with " On preopenstack" and "end preopenstack without success. What am I doing wrong?
Thanks
Herman

Re: Browsing field

Posted: Mon Jul 04, 2011 11:44 am
by shaosean
preOpenStack is too early, try moving it to either the preOpenCard (might still be too early) or openCard

Re: Browsing field

Posted: Mon Jul 04, 2011 11:50 am
by cybernaut
shaosean wrote:preOpenStack is too early, try moving it to either the preOpenCard (might still be too early) or openCard
Already tried without luck!
What could it be?
Herman

Re: Browsing field

Posted: Mon Jul 04, 2011 11:53 am
by shaosean
Might be due to the way the revBrowser external works, so lets try this in your stack/card script

Code: Select all

on preOpenStack
  send "makeBrowserWork" to me in 0 seconds  // this causes the message to be put at the end of the queue
end preOpenStack

on makeBrowserWork
  local tBrowserID
  put revBrowserOpen(the windowID of this stack, "http://www.abc.net/") into tBrowserID  // creates a revBrowser instance and navigates to the website
  revBrowserSet tBrowserID, "rect", (the rect of image "browserRect")  // sets the dimensions of the browser instance to the dimensions of the image
end makeBrowserWork

Re: Browsing field

Posted: Mon Jul 04, 2011 11:59 am
by cybernaut
shaosean wrote:Might be due to the way the revBrowser external works, so lets try this in your stack/card script

Code: Select all

on preOpenStack
  send "makeBrowserWork" to me in 0 seconds  // this causes the message to be put at the end of the queue
end preOpenStack

on makeBrowserWork
  local tBrowserID
  put revBrowserOpen(the windowID of this stack, "http://www.abc.net/") into tBrowserID  // creates a revBrowser instance and navigates to the website
  revBrowserSet tBrowserID, "rect", (the rect of image "browserRect")  // sets the dimensions of the browser instance to the dimensions of the image
end makeBrowserWork
It works!!! I was inserting the code in the wrong stack.
THANK YOU SOO MUCH!! if you were in Brisbane, Australia I will invite you to a few drinks on me!
Thanks mate!
Herman

Re: Browsing field

Posted: Fri Dec 02, 2011 10:35 pm
by maxvit99
Hello, I am having problems with this code:

Code: Select all

on mouseUp
   put empty into field "result"
   put field "URL" into tlocation
   local tBrowserID
   --   creates a revBrowser instance and navigates to the website
   put revBrowserOpen(the windowID of this stack, tlocation) into tBrowserID
   --   sets the dimensions of the browser instance to the dimensions of the image
   revBrowserSet tBrowserID, "rect", (the rect of image "browserRect")
end mouseUp
I am getting a
Navigation to the webpage was canceled
or a
This program cannot display the webpage
note in the field, instead of the contents of the field.
Wy is this happening :?:

Re: Browsing field

Posted: Thu Dec 22, 2011 7:10 pm
by maxvit99
Sorry, it was my antivirus (it was set on a property that let access to the internet only from Windows Internet Explorer). So what I did is turn it off and everything worked well :!:, except that when I typed a new address, it went to it and then, in some minutes it went back ot the first webpage that I visited. So what I do is close that app and then open it again and type the next address :cry: . Is there any other way to do that :?: