locationChanged on mouseUp
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
locationChanged on mouseUp
Is it possible to activate the locationChanged function when the user presses a button, for example?
Currently I have inserted this function in OpenCard but in this way it is always active.
Thank you
Currently I have inserted this function in OpenCard but in this way it is always active.
Thank you
Re: locationChanged on mouseUp
I don't think so, because this is a MESSAGE and not a function.
From the dictionary:
From the dictionary:
So only the CARD (or stack) will receive this message, but none of your buttons or other objects.Sent to the current card of the default stack when the location of the device changes.
Re: locationChanged on mouseUp
Could you not do something like this in the button/whatevers script :
Code: Select all
on mouseUp
send locationChanged(pLat,pLong,pAlt) to card "xyz"
end mouseUp
Alternately, you could roll your own handler for the change in location, since the above still isn't going to change the way the message works (i.e. you have to as Klaus said put the locationChanged handler in the card).
Re: locationChanged on mouseUp
You do not know what values pLat, pLong and pAlt have at this point!bogs wrote: ↑Fri Apr 12, 2019 2:53 pmCode: Select all
on mouseUp send locationChanged(pLat,pLong,pAlt) to card "xyz" end mouseUp
Re: locationChanged on mouseUp
does not work, the app crashes! I would like to use the locationChanged message to trace the user but only if activated by the user. Another solution ?bogs wrote: ↑Fri Apr 12, 2019 2:53 pmCould you not do something like this in the button/whatevers script :Code: Select all
on mouseUp send locationChanged(pLat,pLong,pAlt) to card "xyz" end mouseUp
Alternately, you could roll your own handler for the change in location, since the above still isn't going to change the way the message works (i.e. you have to as Klaus said put the locationChanged handler in the card).
Code: Select all
on mouseUp
mobileStartTrackingSensor "location", false
send locationChanged to this card
end mouseUp
Re: locationChanged on mouseUp
What did you exspect when you pass the STRINGS! "pLat", "pLong" and "pAlt" in that call?link76 wrote: ↑Fri Apr 12, 2019 3:04 pmdoes not work, the app crashes!Code: Select all
on mouseUp send locationChanged(pLat,pLong,pAlt) to card "xyz" end mouseUp
If a variable is empty/not initialized, its value is its name as a string!
You cannot "fake" a message that comes from "outside" of LC, since you do not know the values of pLong etc., see above. However, starting the sensor "on mouseup" should work, but then the "locationchanged" message is still sent to the current card!
Code: Select all
on mouseUp
mobileStartTrackingSensor "location", false
end mouseUp
Re: locationChanged on mouseUp
Hum. I might as well go ahead and show my (even more complete) ignorance again, why not stick the locationChanged handler into a custom property of the card/stack, create a handler such as:
Code: Select all
on myLoc
do the custPropMyLoc of this card
end myLoc
Code: Select all
send myLoc to card "xyz"
I also seem to remember that you could put scripts into objects, without having them there from the beginning, but (unfortunately) don't remember the details.
Re: locationChanged on mouseUp
Obviously I have to repeat myself:
No idea, I faked the phone call.
You get the picture...
Hey, mom called! What did she say?You cannot "fake" a message that comes from "outside" of LC, since you do not know the CURRENT values of pLong etc.
No idea, I faked the phone call.
You get the picture...
Re: locationChanged on mouseUp
Actually I seem to be missing that picture (again, blatant ignorance in how stuff works on mobile). I am pretty sure I used a similar bit to shell out for information on the desktop at one point, but maybe thats different.
Re: locationChanged on mouseUp
This has nothing to do with "how stuff works on mobile", its pure logics!
If you receive a message (with params!) of whatever kind from OUTSIDE of LC, you do not
know what info the params may bring. So you cannot fake nor "force" this message, you can
only react WHEN the message comes in.
Read up my "mom called" example again and let it sink a bit, I'm sure you'll understand the problem.
If you receive a message (with params!) of whatever kind from OUTSIDE of LC, you do not
know what info the params may bring. So you cannot fake nor "force" this message, you can
only react WHEN the message comes in.
Read up my "mom called" example again and let it sink a bit, I'm sure you'll understand the problem.
Re: locationChanged on mouseUp
If you say so. I still don't get it myself, but that isn't really a problem as long as link76 does
See, to me, there is a way to get those from outside and insert them, but again, that might be an error in my thinking.
Re: locationChanged on mouseUp
To use this example here, so you are fetching the current altitude, longitude and whatever values with your sextant and then pass it over to LC?
Again:
We cannot know the values of the parameters of the "message-to-come" BEFORE the message arrives! Agreed?
Re: locationChanged on mouseUp
Ah, I (think) I see what your talking about, but I also think we are talking at cross purposes because I am lacking some fundamental basic understanding about programming for mobile.
On what you said in the last post, agreed, I don't think you can *fake* a message that comes from outside of Lc, I just think there is a way to get the items that make up the message and bend it to our needs. Unfortunately, what way that is is beyond me due to ignorance.
On what you said in the last post, agreed, I don't think you can *fake* a message that comes from outside of Lc, I just think there is a way to get the items that make up the message and bend it to our needs. Unfortunately, what way that is is beyond me due to ignorance.
Re: locationChanged on mouseUp
Ah, finally, yes, that was my only point, since I only referred to this example with "locationchanged()".
Yes, sure, but just not all.
Re: locationChanged on mouseUp
What he wants is probably to get the current location. If he wants to track changes, then he would respond to the message he originally asked about. Both require the app to start tracking location as mentioned earlier in the thread. I’m not sure if enabling tracking will generate the change message initially which is why I’m suggesting this function.
Code: Select all
mobileCurrentLocation()
Brian Milby
Script Tracker https://github.com/bwmilby/scriptTracker
Script Tracker https://github.com/bwmilby/scriptTracker