Page 1 of 1

[SOLVED] Handling status messages

Posted: Sat Feb 07, 2015 7:01 pm
by andy60
hi, using browser control in Safari i don't see status messages, here is the code:

Code: Select all

# provide a status message that indicates loading has started
on browserStartedLoading pUrl
  put "Started loading:" && pUrl into field "Status"
end browserStartedLoading
and

Code: Select all

# provide a status message that indicates loading has ended
on browserFinishedLoading pUrl
   put "Finished loading:" && pURL into field "Status"
   put pURL into field "url"
end browserFinishedLoading
The code is inserted in card script. My mistake? Thx for the help.

Re: Handling status messages

Posted: Sun Feb 08, 2015 12:41 pm
by Klaus
Hi Andi,
andy60 wrote:hi, using browser control in Safari
??? :shock:
Could you explain a bit?


Best

Klaus

Re: Handling status messages

Posted: Sun Feb 08, 2015 1:19 pm
by andy60
Klaus wrote:Hi Andi,
andy60 wrote:hi, using browser control in Safari
??? :shock:
Could you explain a bit?


Best

Klaus
excuse me Klaus for my bad english! :-) i post screenshot of mybrowser. My problems are:
- refresh url after end of navigation
- sent info during navigation in the field at the bottom of the window
as i show in the picture. Thx for your help.

Re: Handling status messages

Posted: Sun Feb 08, 2015 1:33 pm
by Klaus
Hi Andy,
using browser control in Safari
this is not bad english, but just plain wrong, you are using a browser control in Livecode, right? :D

And again a look into the dictionary brings enlightment! 8)

The messages "browserStartedLoading" and "browserFinishedLoading" are MOBILE only!
On the desktop use "browserBeforeNavigate" and "browserNavigateComplete".


Best

Klaus

Re: Handling status messages

Posted: Sun Feb 08, 2015 4:01 pm
by andy60
Klaus wrote:Hi Andy,
using browser control in Safari
this is not bad english, but just plain wrong, you are using a browser control in Livecode, right? :D

And again a look into the dictionary brings enlightment! 8)

The messages "browserStartedLoading" and "browserFinishedLoading" are MOBILE only!
On the desktop use "browserBeforeNavigate" and "browserNavigateComplete".


Best

Klaus
dear Klaus, i'm a very lc enthusiast but...a newbee :D

Re: Handling status messages

Posted: Sun Feb 08, 2015 4:17 pm
by Klaus
Hi Andi,

this is not a question if newbie or not, but a general understanding problem :D
The messages "browserStartedLoading" and "browserFinishedLoading" are MOBILE only!
In other words:
The messages "browserStartedLoading" and "browserFinishedLoading" ARE ONLY being send ion iOS or Android.
And your screenshot shows a desktop app (IDE or standalone) and these commands do not work here!

Simply replace the two commands (and I mean BOTH!) in your script and that should do it:

Code: Select all

# provide a status message that indicates loading has started
on browserBeforeNavigate pUrl
  put "Started loading:" && pUrl into field "Status"
end browserBeforeNavigate

# provide a status message that indicates loading has ended
on browserNavigateComplete pUrl
   put "Finished loading:" && pURL into field "Status"
   put pURL into field "url"
end browserNavigateComplete
Please check the dictionary next time when in doubt about syntax, you will see a little icon after: Supported Operating Systems!


Best

Klaus

Re: Handling status messages

Posted: Sun Feb 08, 2015 4:23 pm
by andy60
Klaus wrote:Hi Andi,

this is not a question if newbie or not, but a general understanding problem :D
The messages "browserStartedLoading" and "browserFinishedLoading" are MOBILE only!
In other words:
The messages "browserStartedLoading" and "browserFinishedLoading" ARE ONLY being send ion iOS or Android.
And your screenshot shows a desktop app (IDE or standalone) and these commands do not work here!

Simply replace the two commands (and I mean BOTH!) in your script and that should do it:

Code: Select all

# provide a status message that indicates loading has started
on browserBeforeNavigate pUrl
  put "Started loading:" && pUrl into field "Status"
end browserBeforeNavigate

# provide a status message that indicates loading has ended
on browserNavigateComplete pUrl
   put "Finished loading:" && pURL into field "Status"
   put pURL into field "url"
end browserNavigateComplete
Please check the dictionary next time when in doubt about syntax, you will see a little icon after: Supported Operating Systems!


Best

Klaus
Solved, thx Klaus

Code: Select all

# provide a status message that indicates loading has started
on browserBeforeNavigate myBrowser,pUrl
  put "Started loading:" && pUrl into field "Status"
end browserBeforeNavigate

# provide a status message that indicates loading has ended
on browserNavigateComplete mybrowser,pUrl
   put pURL into field "url"
   put "Finished loading:" && pUrl into field "Status"
   wait for 2 seconds
   put " " into field "Status"
end browserNavigateComplete

Re: Handling status messages

Posted: Sun Feb 08, 2015 4:26 pm
by Klaus
Molto bene! :D

Re: Handling status messages

Posted: Sun Feb 08, 2015 5:48 pm
by andy60
Klaus wrote:Molto bene! :D
yeah, my actual goal is to write code for image browser resizing when i resize the card :D

Re: Handling status messages

Posted: Sun Feb 08, 2015 6:44 pm
by Klaus
Okie Dokie, then simply set the browserrect in in your "resizestack" script to the new calcluated size. :D

Remember that "resizestack" comes with 4 parameters:
on resizestack newWidth,newHeight,oldWidth,oldHeight
So computing the new neccessary rect for the browser shold be no problem.

Re: Handling status messages

Posted: Mon Feb 09, 2015 1:54 am
by andy60
Klaus wrote:Okie Dokie, then simply set the browserrect in in your "resizestack" script to the new calcluated size. :D

Remember that "resizestack" comes with 4 parameters:
on resizestack newWidth,newHeight,oldWidth,oldHeight
So computing the new neccessary rect for the browser shold be no problem.
Hi, i studied this example http://lessons.runrev.com/m/4071/l/2384 ... is-resized.

In the card script:

Code: Select all

on resizeStack cardWidth, cardHeight
--graphics and list field
set the width of graphic "rectangle" to cardWidth
set the topleft of graphic "rectangle" to 0,0
set the points of graphic "line" to the bottomleft of graphic "rectangle" & return & the bottomright of graphic "rectangle"
put 0 into listFieldLeft
put the bottom of graphic "rectangle" +1 into listFieldTop
put cardWidth into listFieldright
put cardHeight -14 into listFieldbottom
set the rect of field "list" to listFieldLeft,listFieldTop,listFieldRight,listFieldBottom

--search field and buttons
set the right of button "button 3" to cardWidth - 9
set the right of button "button 2" to the left of button "button 3" - 3
set the right of button "button 1" to the left of button "button 2" - 3
put the topleft of field "search" into savedTopLeft
put the left of button "button 1" - the left of field "search" -3 into theWidth
set the width of field "search" to theWidth
set the topleft of field "search" to savedTopLeft
end resizeStack
With textfield and buttons i have no problem in resizing coding script.
My problem is resize the image object used for browser container.
In both livecode mode (execution or programming) i have difficulties to
manual resize the image. The image seems to be blocked and duplicated.
So i can delete the image e restart my operation. Do you know this problem?

Other consideration on browser:
with edit pointer set to 'on' browser is also active. Why? I can't resize the image field.