SourceForge logo
SourceForge logo
Menu

wxlua-users

From: Chunlin Z. <zha...@gm...> - 2010年05月04日 13:44:05
If I want to do some mutithread programming,how can I do using wxlua in 
pure lua?
Thanks!
From: Chunlin Z. <zha...@gm...> - 2010年05月05日 02:42:08
I search this maillist and found the mail thread discuss same condition: 
news://news.gmane.org:119/loo...@po...
I would try to using luatask and wxPostEvent to wxlua main thread in 
another thread.
On 2010年5月4日 21:43, Chunlin Zhang wrote:
> If I want to do some mutithread programming,how can I do using wxlua in
> pure lua?
> Thanks!
>
>
> ------------------------------------------------------------------------------
From: John L. <jla...@gm...> - 2010年05月05日 17:39:36
On Tue, May 4, 2010 at 9:43 AM, Chunlin Zhang <zha...@gm...> wrote:
> If I want to do some mutithread programming,how can I do using wxlua in
> pure lua?
You can use Lua's coroutines, see the sample coroutine.wx.lua or more
generally Google for sample code using Lua coroutines. wxThread will
be added in the 2.9 release of wxLua, which may be in a few months.
You can also see some coroutine usage in the program gpeddler2, it was
written for a very old version of wxLua so it might not run out of the
box, but wxLua hasn't changed too much. It at least might give you
some ideas.
http://www.erix.it/progutil/gpeddler2/help/gpeddler2.html
Regards,
 John
From: Chunlin Z. <zha...@gm...> - 2010年05月14日 13:57:33
On 2010年5月6日 1:39, John Labenski wrote:
> On Tue, May 4, 2010 at 9:43 AM, Chunlin Zhang<zha...@gm...> wrote:
>> If I want to do some mutithread programming,how can I do using wxlua in
>> pure lua?
>
> You can use Lua's coroutines, see the sample coroutine.wx.lua or more
> generally Google for sample code using Lua coroutines. wxThread will
> be added in the 2.9 release of wxLua, which may be in a few months.
Lua's coroutines can not solve my problem I think.
My situation is that I have several thread(I use luatask,because 
coroutine I think it is not suitable here) to communicate with rs232 
port,and when some data was send to wxlua main thread.
At first I did not know how to receive data from other thread in main 
thread,so I thought I can new a wxthread to wait the data from other 
thread and then send event to wxlua main thread.
Now I use the way that main thread handle the "wxEVT_IDLE",in this event 
handle I try to receive data.And it works
>
> You can also see some coroutine usage in the program gpeddler2, it was
> written for a very old version of wxLua so it might not run out of the
> box, but wxLua hasn't changed too much. It at least might give you
> some ideas.
>
> http://www.erix.it/progutil/gpeddler2/help/gpeddler2.html
>
> Regards,
> John
>
> ------------------------------------------------------------------------------
From: John L. <jla...@gm...> - 2010年05月05日 17:42:31
This is the link to the download page for gpeddler2.
http://www.erix.it/progutil.html#gpeddler2
Regards,
 John
On Wed, May 5, 2010 at 1:39 PM, John Labenski <jla...@gm...> wrote:
> On Tue, May 4, 2010 at 9:43 AM, Chunlin Zhang <zha...@gm...> wrote:
>> If I want to do some mutithread programming,how can I do using wxlua in
>> pure lua?
>
> You can use Lua's coroutines, see the sample coroutine.wx.lua or more
> generally Google for sample code using Lua coroutines. wxThread will
> be added in the 2.9 release of wxLua, which may be in a few months.
>
> You can also see some coroutine usage in the program gpeddler2, it was
> written for a very old version of wxLua so it might not run out of the
> box, but wxLua hasn't changed too much. It at least might give you
> some ideas.
>
> http://www.erix.it/progutil/gpeddler2/help/gpeddler2.html
>
> Regards,
>   John
>
From: Chunlin Z. <zha...@gm...> - 2010年08月19日 05:25:39
于 2010年05月14日 21:57, Chunlin Zhang 写道:
> Now I use the way that main thread handle the "wxEVT_IDLE",in this event
> handle I try to receive data.And it works
>
In linux(I use ubuntu),I found that wxEVT_IDLE only happy when mouse 
move in mainframe,so I have create a timer to run the function.
'''
 --idle event,continue to find message to handle again and again
 mainframe:Connect(wx.wxEVT_IDLE,
 function(event)
 mainframe_on_idle(mainframe,event)
 end)
 --in linux,wxEVT_IDLE only happy when mouse move in mainframe
 --so I create a timer for doing mainframe_on_idle
 local timer = wx.wxTimer(mainframe)
 mainframe:Connect(wx.wxEVT_TIMER,
 function(event)
 mainframe_on_idle(mainframe,event)
 end)
 timer:Start(800)
'''
From: John L. <jla...@gm...> - 2010年08月19日 22:40:36
On Thu, Aug 19, 2010 at 1:25 AM, Chunlin Zhang <zha...@gm...> wrote:
> 于 2010年05月14日 21:57, Chunlin Zhang 写道:
>> Now I use the way that main thread handle the "wxEVT_IDLE",in this event
>> handle I try to receive data.And it works
>>
> In linux(I use ubuntu),I found that wxEVT_IDLE only happy when mouse
> move in mainframe,so I have create a timer to run the function.
Note that you can also call wxIdleEvent::RequestMore(true) to get
another idle event. Note that doing this uses 100% of the processor so
be sure to call it only when you really are processing, but the
application will be responsive. This is a standard way in wxWidgets to
process something without using threads and have a cancel button
usable.
Regards,
 John Labenski
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /