Xojo Conferences
XDCMay2019MiamiUSA

[MBS] Re: CallDelegateOnMainThreadMBS (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Previous thread: [MBS] [ANN] 18.0pr7
Next thread: [MBS] WindowsMidiMBS.Idle vs WindowsMidiInputMBS.Idle


Re: [MBS] How to receive AppleScipt   -   Garth Hjelte
  [MBS] Re: CallDelegateOnMainThreadMBS   -   Julia Truchsess
    [MBS] CallDelegateOnMainThreadMBS   -   Julia Truchsess
     Re: [MBS] CallDelegateOnMainThreadMBS   -   Christian Schmitz
    [MBS] CallDelegateOnMainThreadMBS   -   Julia Truchsess
     Re: [MBS] CallDelegateOnMainThreadMBS   -   Christian Schmitz
    [MBS] CallDelegateOnMainThreadMBS   -   Julia Truchsess
     Re: [MBS] CallDelegateOnMainThreadMBS   -   Christian Schmitz
     Re: [MBS] CallDelegateOnMainThreadMBS   -   GMX

[MBS] Re: CallDelegateOnMainThreadMBS
Date: 10.01.18 17:40 (Wed, 10 Jan 2018 16:40:50 +0000)
From: Julia Truchsess

Date: Wed, 10 Jan 2018 09:45:34 +0100
From: Christian Schmitz <<email address removed><mailto:<email address removed>>>
Subject: Re: [MBS] CallDelegateOnMainThreadMBS
To: MBS-Plugin-Liste Plugin List <<email address removed><mailto:<email address removed>>>
Message-ID:
<<email address removed><mailto:<email address removed>>>
Content-Type: text/plain; charset=utf-8

but it gives a compiler error of “There is more than one item with this name and it’s not clear to which this refers”, with the entire second line highlighted. I’ve also tried declaring themessage as a Variant and then assigning the IPCMessage to it, but it gives the same result.

SendIPCmessage needs to be defined to take a variant. Than It may work.

Awesome, it works, thanks! :)
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

[MBS] CallDelegateOnMainThreadMBS
Date: 10.01.18 02:22 (Wed, 10 Jan 2018 01:22:01 +0000)
From: Julia Truchsess
I have a method in a module called “SendIPCMessage”, which takes one parameter of type IPCMessage. If it gets called from a thread it raises a AccessingUIfromThread exception due to some UI interaction, so I’m trying to use CallDelegateOnMainThreadMBS like this:

dim themessage As IPCMessage = new IPCMessage(Hdr_DvcCmd,Command,DCP_SysID,Str(Payload))
CallDelegateOnMainThreadMBS(AddressOf SendIPCmessage,themessage)

but it gives a compiler error of “There is more than one item with this name and it’s not clear to which this refers”, with the entire second line highlighted. I’ve also tried declaring themessage as a Variant and then assigning the IPCMessage to it, but it gives the same result.

What am I doing wrong?

Thanks,
Julia
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] CallDelegateOnMainThreadMBS
Date: 10.01.18 09:45 (Wed, 10 Jan 2018 09:45:34 +0100)
From: Christian Schmitz

> but it gives a compiler error of “There is more than one item with this name and it’s not clear to which this refers”, with the entire second line highlighted. I’ve also tried declaring themessage as a Variant and then assigning the IPCMessage to it, but it gives the same result.

SendIPCmessage needs to be defined to take a variant. Than It may work.

Sincerely
Christian

[MBS] CallDelegateOnMainThreadMBS
Date: 04.01.18 16:38 (Thu, 4 Jan 2018 15:38:33 +0000)
From: Julia Truchsess

Date: Thu, 4 Jan 2018 08:01:53 +0100
From: GMX <<email address removed><mailto:<email address removed>>>
Subject: Re: [MBS] CallDelegateOnMainThreadMBS

You need to use the address of a method and not the method itself. If you have a method called HandleUpdateAction with a parameter Message then you need to do

CallDelegateOnMainThreadMBS AddressOf HandleUpdateAction, Message

Thanks, Beatrix. I know what a delegate is. What confused me is the “_delegateMBS” in the method spec. So I can use the address of _any_ method as a delegate target for CallDelegateOnMainThread? It doesn’t have to be a special “_delegateMBS”?

From: Christian Schmitz <<email address removed><mailto:<email address removed>>>
Subject: Re: [MBS] CallDelegateOnMainThreadMBS

It is not a class, but a delegate. In face, it’s 50 delegates for various variations.

Still confused. Is there documentation for these "50 delegates for various variations”?

Thanks.
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] CallDelegateOnMainThreadMBS
Date: 04.01.18 16:42 (Thu, 4 Jan 2018 16:42:10 +0100)
From: Christian Schmitz

>
> Thanks, Beatrix. I know what a delegate is. What confused me is the “_delegateMBS” in the method spec. So I can use the address of _any_ method as a delegate target for CallDelegateOnMainThread? It doesn’t have to be a special “_delegateMBS”?

_delegateMBS is the name of a hidden (due to _ in front) delegate definition.
Actually we define those here:

CallDelegateOnMainThreadMBS(m as _delegateMBS)
CallDelegateOnMainThreadMBS(m as _delegateMBSo, p1 as Object)
CallDelegateOnMainThreadMBS(m as _delegateMBSoo, p1 as Object, p2 as Object)
CallDelegateOnMainThreadMBS(m as _delegateMBSoi, p1 as Object, p2 as Integer)
CallDelegateOnMainThreadMBS(m as _delegateMBSov, p1 as Object, p2 as Variant)
CallDelegateOnMainThreadMBS(m as _delegateMBSos, p1 as Object, p2 as String)
CallDelegateOnMainThreadMBS(m as _delegateMBSod, p1 as Object, p2 as Double)
CallDelegateOnMainThreadMBS(m as _delegateMBSob, p1 as Object, p2 as Boolean)
CallDelegateOnMainThreadMBS(m as _delegateMBSi, p1 as Integer)
CallDelegateOnMainThreadMBS(m as _delegateMBSio, p1 as Integer, p2 as Object)
CallDelegateOnMainThreadMBS(m as _delegateMBSii, p1 as Integer, p2 as Integer)
CallDelegateOnMainThreadMBS(m as _delegateMBSiv, p1 as Integer, p2 as Variant)
CallDelegateOnMainThreadMBS(m as _delegateMBSis, p1 as Integer, p2 as String)
CallDelegateOnMainThreadMBS(m as _delegateMBSid, p1 as Integer, p2 as Double)
CallDelegateOnMainThreadMBS(m as _delegateMBSib, p1 as Integer, p2 as Boolean)
CallDelegateOnMainThreadMBS(m as _delegateMBSv, p1 as Variant)
CallDelegateOnMainThreadMBS(m as _delegateMBSvo, p1 as Variant, p2 as Object)
CallDelegateOnMainThreadMBS(m as _delegateMBSvi, p1 as Variant, p2 as Integer)
CallDelegateOnMainThreadMBS(m as _delegateMBSvv, p1 as Variant, p2 as Variant)
CallDelegateOnMainThreadMBS(m as _delegateMBSvs, p1 as Variant, p2 as String)
CallDelegateOnMainThreadMBS(m as _delegateMBSvd, p1 as Variant, p2 as Double)
CallDelegateOnMainThreadMBS(m as _delegateMBSvb, p1 as Variant, p2 as Boolean)
CallDelegateOnMainThreadMBS(m as _delegateMBSs, p1 as String)
CallDelegateOnMainThreadMBS(m as _delegateMBSso, p1 as String, p2 as Object)
CallDelegateOnMainThreadMBS(m as _delegateMBSsi, p1 as String, p2 as Integer)
CallDelegateOnMainThreadMBS(m as _delegateMBSsv, p1 as String, p2 as Variant)
CallDelegateOnMainThreadMBS(m as _delegateMBSss, p1 as String, p2 as String)
CallDelegateOnMainThreadMBS(m as _delegateMBSsd, p1 as String, p2 as Double)
CallDelegateOnMainThreadMBS(m as _delegateMBSsb, p1 as String, p2 as Boolean)
CallDelegateOnMainThreadMBS(m as _delegateMBSd, p1 as Double)
CallDelegateOnMainThreadMBS(m as _delegateMBSdo, p1 as Double, p2 as Object)
CallDelegateOnMainThreadMBS(m as _delegateMBSdi, p1 as Double, p2 as Integer)
CallDelegateOnMainThreadMBS(m as _delegateMBSdv, p1 as Double, p2 as Variant)
CallDelegateOnMainThreadMBS(m as _delegateMBSds, p1 as Double, p2 as String)
CallDelegateOnMainThreadMBS(m as _delegateMBSdd, p1 as Double, p2 as Double)
CallDelegateOnMainThreadMBS(m as _delegateMBSdb, p1 as Double, p2 as Boolean)
CallDelegateOnMainThreadMBS(m as _delegateMBSb, p1 as Boolean)
CallDelegateOnMainThreadMBS(m as _delegateMBSbo, p1 as Boolean, p2 as Object)
CallDelegateOnMainThreadMBS(m as _delegateMBSbi, p1 as Boolean, p2 as Integer)
CallDelegateOnMainThreadMBS(m as _delegateMBSbv, p1 as Boolean, p2 as Variant)
CallDelegateOnMainThreadMBS(m as _delegateMBSbs, p1 as Boolean, p2 as String)
CallDelegateOnMainThreadMBS(m as _delegateMBSbd, p1 as Boolean, p2 as Double)
CallDelegateOnMainThreadMBS(m as _delegateMBSbb, p1 as Boolean, p2 as Boolean)

The documentation just shows the first one. But all those combinations work and it looks like magic.

Sincerely
Christian

[MBS] CallDelegateOnMainThreadMBS
Date: 04.01.18 05:18 (Thu, 4 Jan 2018 04:18:53 +0000)
From: Julia Truchsess
CallDelegateOnMainThreadMBS looks really useful, but I’m confused by the spec:

"CallDelegateOnMainThreadMBS(m as _delegateMBS)”

because I can’t find any information on any class “_delegateMBS”.

The examples, like "CallDelegateOnMainThreadMBS AddressOf testString, “Hello”” seem to be using just the name of any method, not a special _delegateMBS class.

Can someone please give a little more detail about the usage?

Thanks,
Julia
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] CallDelegateOnMainThreadMBS
Date: 04.01.18 10:42 (Thu, 4 Jan 2018 10:42:26 +0100)
From: Christian Schmitz

> Am 04.01.2018 um 05:18 schrieb Julia Truchsess <<email address removed>>:
>
> CallDelegateOnMainThreadMBS looks really useful, but I’m confused by the spec:
>
> "CallDelegateOnMainThreadMBS(m as _delegateMBS)”
>
> because I can’t find any information on any class “_delegateMBS”.

It is not a class, but a delegate. In face, it’s 50 delegates for various variations.

For 0, 1 or 2 arguments of type object, integer, variant, string, double or boolean.

Sincerely
Christian

Re: [MBS] CallDelegateOnMainThreadMBS
Date: 04.01.18 08:01 (Thu, 4 Jan 2018 08:01:53 +0100)
From: GMX
You need to use the address of a method and not the method itself. If you have a method called HandleUpdateAction with a parameter Message then you need to do

CallDelegateOnMainThreadMBS AddressOf HandleUpdateAction, Message

with the function.

CallDelegateOnMainThreadMBS rocks!

Mit freundlichen Grüßen/Regards

Beatrix Willius

http://www.mothsoftware.com <http://www.mothsoftware.com/>
Mail Archiver X: The email archiving solution for professionals

> Am 04.01.2018 um 05:18 schrieb Julia Truchsess <<email address removed> <mailto:<email address removed>>>:
>
> CallDelegateOnMainThreadMBS looks really useful, but I’m confused by the spec:
>
> "CallDelegateOnMainThreadMBS(m as _delegateMBS)”
>
> because I can’t find any information on any class “_delegateMBS”.
>
> The examples, like "CallDelegateOnMainThreadMBS AddressOf testString, “Hello”” seem to be using just the name of any method, not a special _delegateMBS class.
>
> Can someone please give a little more detail about the usage?

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info