wxGrid or wxListCtrl
Milan Babuskov
milanb at panonnet.net
Wed Apr 16 00:28:16 PDT 2008
Thibault Genessay wrote:
>> >> 3. I also want some trivial thing like to scroll among these records
>> >> while the GUI refreshing records.
>> >
>> > Use two threads.
>
> That's a strange advice for several reasons:
> 1) wxWidgets does not like it at all when two threads access the GUI.
I didn't write that, but I guess I was too lazy to write the whole 'how
to do multi-threaded programing with wx' story.
> So "refreshing"
> the GUI from another thread is absolutely not an option.
Of course. The OP's question wasn't formed correctly as he doesn't know
about internals. It's the secondary thread that changes virtual data
storage and events are posted to GUI thread to refresh records.
> 2) You don't even need threads for that. The user can scroll when the
> list is being refreshed. There is absolutely no need to do anything
> special about it. The user scrolls, wxWidgets queries for the data -
> all of this occurs in the same thread without a problem.
So, you propose that those animations OP talked about 'work' while data
is being queried? What happens when user doesn't do any action that
doesn't refresh any data (i.e. no queries)? Animations would stop.
> You could need to use threads if you wanted to update your data
> storage (i.e. the place where your data is actually stored, and where
> you look for you data when wxWidgets asks you for it) asynchronously.
> But remember that if you do so, you must protect your data with a
> mutex (or implement a finer-grained - per-block-of-rows, for instance
> - locking mechanism). There is a performance issue here if you don't
> implement that feature carefully.
I think he will have to do this.
--
Milan Babuskov
http://www.flamerobin.org
More information about the wx-users
mailing list