PreOpenBackground Messages

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

PreOpenBackground Messages

Stephen MacLean via use-livecode
Quick question about the PreOpenBackground messages...

If you have 2 background groups that both use the same button as their
behavior with the following code:

on preOpenBackground
   put the short id of me after msg
end preOpenBackground

Wouldn't you expect to see the ID of both groups?
I'm seeing the ID of one group twice.

Thanks,
Brian
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: PreOpenBackground Messages

Stephen MacLean via use-livecode
Change you code to:

put the short id of this me after msg


 On 9/5/2018 1:23 AM, Brian Milby via use-livecode wrote:

> Quick question about the PreOpenBackground messages...
>
> If you have 2 background groups that both use the same button as their
> behavior with the following code:
>
> on preOpenBackground
>    put the short id of me after msg
> end preOpenBackground
>
> Wouldn't you expect to see the ID of both groups?
> I'm seeing the ID of one group twice.
>
> Thanks,
> Brian
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: PreOpenBackground Messages

Stephen MacLean via use-livecode
That yields two copies of the behavior button id

Thanks,
Brian
On Sep 5, 2018, 7:17 AM -0500, Paul Dupuis via use-livecode <[hidden email]>, wrote:

> Change you code to:
>
> put the short id of this me after msg
>
>
>  On 9/5/2018 1:23 AM, Brian Milby via use-livecode wrote:
> > Quick question about the PreOpenBackground messages...
> >
> > If you have 2 background groups that both use the same button as their
> > behavior with the following code:
> >
> > on preOpenBackground
> > put the short id of me after msg
> > end preOpenBackground
> >
> > Wouldn't you expect to see the ID of both groups?
> > I'm seeing the ID of one group twice.
> >
> > Thanks,
> > Brian
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: PreOpenBackground Messages

Stephen MacLean via use-livecode
In reply to this post by Stephen MacLean via use-livecode
Same issue with openbackground

Thanks,
Brian
On Sep 5, 2018, 7:17 AM -0500, Paul Dupuis via use-livecode <[hidden email]>, wrote:

> Change you code to:
>
> put the short id of this me after msg
>
>
>  On 9/5/2018 1:23 AM, Brian Milby via use-livecode wrote:
> > Quick question about the PreOpenBackground messages...
> >
> > If you have 2 background groups that both use the same button as their
> > behavior with the following code:
> >
> > on preOpenBackground
> > put the short id of me after msg
> > end preOpenBackground
> >
> > Wouldn't you expect to see the ID of both groups?
> > I'm seeing the ID of one group twice.
> >
> > Thanks,
> > Brian
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: PreOpenBackground Messages

Stephen MacLean via use-livecode
In reply to this post by Stephen MacLean via use-livecode
You may need to pass the message. From the dictionary entry for
preOpenBackground:

"If the card does not handle the message, or passes it, the message
proceeds through each group in reverse layer order (from highest to
lowest)."

On 9/5/18 12:23 AM, Brian Milby via use-livecode wrote:

> Quick question about the PreOpenBackground messages...
>
> If you have 2 background groups that both use the same button as their
> behavior with the following code:
>
> on preOpenBackground
>     put the short id of me after msg
> end preOpenBackground
>
> Wouldn't you expect to see the ID of both groups?
> I'm seeing the ID of one group twice.


--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: PreOpenBackground Messages

Stephen MacLean via use-livecode
Interesting.

Now that I re-read it, I see the solution.  That seems really odd though,
why would the message go through every background?

So, I need a "if pBackgroundID is not the id of me then pass
preOpenBackground" in each handler.  Now I need to go fix my MobileDemo
stack :)

Thanks for the good catch.

Brian

On Wed, Sep 5, 2018 at 2:36 PM J. Landman Gay via use-livecode <
[hidden email]> wrote:

> You may need to pass the message. From the dictionary entry for
> preOpenBackground:
>
> "If the card does not handle the message, or passes it, the message
> proceeds through each group in reverse layer order (from highest to
> lowest)."
>
> On 9/5/18 12:23 AM, Brian Milby via use-livecode wrote:
> > Quick question about the PreOpenBackground messages...
> >
> > If you have 2 background groups that both use the same button as their
> > behavior with the following code:
> >
> > on preOpenBackground
> >     put the short id of me after msg
> > end preOpenBackground
> >
> > Wouldn't you expect to see the ID of both groups?
> > I'm seeing the ID of one group twice.
>
>
> --
> Jacqueline Landman Gay         |     [hidden email]
> HyperActive Software           |     http://www.hyperactivesw.com
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: PreOpenBackground Messages

Stephen MacLean via use-livecode
Because the background is being opened when the card is loaded. All backgrounds on the card are opened, and therefore pre-opened.

Bob S


> On Sep 5, 2018, at 13:20 , Brian Milby via use-livecode <[hidden email]> wrote:
>
> Interesting.
>
> Now that I re-read it, I see the solution.  That seems really odd though,
> why would the message go through every background?


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: PreOpenBackground Messages

Stephen MacLean via use-livecode
Right, but the message for group B is sent to group A. If A doesn’t pass, B never sees it. I see it in the dictionary, but it seems weird.

The openBackground works the same way, but the dictionary entry there makes it sound like the message is direct. I only read that entry which is why I was confused. That entry needs to be updated to match preOpenBackground. An example in each would be good too. I’ll have to work on updates there.

Thanks,
Brian
On Sep 5, 2018, 3:29 PM -0500, Bob Sneidar via use-livecode <[hidden email]>, wrote:

> Because the background is being opened when the card is loaded. All backgrounds on the card are opened, and therefore pre-opened.
>
> Bob S
>
>
> > On Sep 5, 2018, at 13:20 , Brian Milby via use-livecode <[hidden email]> wrote:
> >
> > Interesting.
> >
> > Now that I re-read it, I see the solution. That seems really odd though,
> > why would the message go through every background?
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: PreOpenBackground Messages

Stephen MacLean via use-livecode
On 09/05/2018 01:45 PM, Brian Milby via use-livecode wrote:
> Right, but the message for group B is sent to group A. If A doesn’t pass, B never sees it. I see it in the dictionary, but it seems weird.

Yeah, that just seems wrong to me. Doesn't seem like there should be a
hierarchy for background groups.

--
  Mark Wieder
  [hidden email]

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: PreOpenBackground Messages

Stephen MacLean via use-livecode
The alternative would be to send a separate message for every background on a card. It is odd though. Brian, have you tried the target to determine the group you need?

Bob S


> On Sep 5, 2018, at 13:55 , Mark Wieder via use-livecode <[hidden email]> wrote:
>
> On 09/05/2018 01:45 PM, Brian Milby via use-livecode wrote:
>> Right, but the message for group B is sent to group A. If A doesn’t pass, B never sees it. I see it in the dictionary, but it seems weird.
>
> Yeah, that just seems wrong to me. Doesn't seem like there should be a hierarchy for background groups.
>
> --
> Mark Wieder

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: PreOpenBackground Messages

Stephen MacLean via use-livecode
There is a parameter to tell which group is the target of the message. I didn’t think the group would need to check to see if it was supposed to be the target of the message though. The openBackground dictionary entry doesn’t make that clear. The preOpenBackground dictionary entry does point it out though.

In my case, I wanted to do an initialization of some script locals to avoid calculating them each resize. I was trying to eliminate an if statement to check for initialization. For other reasons, I’m leaving in that check though.

Thanks,
Brian
On Sep 5, 2018, 4:53 PM -0500, Bob Sneidar via use-livecode <[hidden email]>, wrote:

> The alternative would be to send a separate message for every background on a card. It is odd though. Brian, have you tried the target to determine the group you need?
>
> Bob S
>
>
> > On Sep 5, 2018, at 13:55 , Mark Wieder via use-livecode <[hidden email]> wrote:
> >
> > On 09/05/2018 01:45 PM, Brian Milby via use-livecode wrote:
> > > Right, but the message for group B is sent to group A. If A doesn’t pass, B never sees it. I see it in the dictionary, but it seems weird.
> >
> > Yeah, that just seems wrong to me. Doesn't seem like there should be a hierarchy for background groups.
> >
> > --
> > Mark Wieder
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode