Forms and stuff?

10 views
Skip to first unread message

skerrj

unread,
Sep 8, 2008, 4:57:27 PM9/8/08
to retlang-dev, ske...@gmail.com
How's it going?

Do you have any examples, or patterns, of Retlang being used with
System.Window.Form's?

I tried some testing and I'm getting the following runtime error:
"Cross-thread operation not valid: Control 'outBox' accessed from a
thread other than the thread it was created on." I have a GuiBroker
retlang thread, which gets the Form object at construction, and a
public SetOutbox methed in the Forms class which sets the outBox.

Should my form be a member of the GuiBroker? Or can I use events and
just hand an event class to the GuiBroker? Or...?

Any help would be great,
Thanks,
Scott Johnson

skerrj

unread,
Sep 8, 2008, 6:05:01 PM9/8/08
to retlang-dev
This worked.... but have a feeling it's not the best solution:
checkForIllegalCrossThreadCalls = false;

Mike Rettig

unread,
Sep 8, 2008, 7:42:20 PM9/8/08
to retla...@googlegroups.com
The controls need to be invoked on the ui thread. Retlang events will be called from the backing thread or a thread pool thread.

The best way to do this is to write a custom CommandExecutor that invokes the events on the UI thread automagically.

http://code.google.com/p/retlang/wiki/CommandExecutor

The commands can be invoked asynchronously or with a synchronized invoke.

http://msdn.microsoft.com/en-us/library/zyzhdc6b.aspx

http://msdn.microsoft.com/en-us/library/system.windows.forms.control.begininvoke.aspx

Make sense?

Mike

skerrj

unread,
Sep 9, 2008, 1:14:27 PM9/9/08
to retlang-dev
Not really.... not seeing it at the moment...won't have a chance to
play with it for a bit... have deadline... will hack and then get back
to this... would rather be doing this.
Thanks for the quick response, will let you know how it goes,
Scott

On Sep 8, 4:42 pm, "Mike Rettig" <mike.ret...@gmail.com> wrote:
> The controls need to be invoked on the ui thread. Retlang events will be
> called from the backing thread or a thread pool thread.
>
> The best way to do this is to write a custom CommandExecutor that invokes
> the events on the UI thread automagically.
>
> http://code.google.com/p/retlang/wiki/CommandExecutor
>
> The commands can be invoked asynchronously or with a synchronized invoke.
>
> http://msdn.microsoft.com/en-us/library/zyzhdc6b.aspx
>
> http://msdn.microsoft.com/en-us/library/system.windows.forms.control....
Reply all
Reply to author
Forward
0 new messages