Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Select Grid Row BY ID
Re: Select Grid Row BY ID [message #48071 is a reply to message #48059] Sun, 14 May 2017 16:18 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1093
Registered: August 2007
Senior Contributor
Hello germax,

I've hopefully "fixed" your code. I only had time for examining the Single- worker threaded variant. It shoudl work now. At least it works on my machines
(A dell laptop with i5-6200i, 4 gb ram, and a destop pc with AMD Fx 6100 six core processor, 16 GB ram.).

I've also made some small comments here and there.

Pleas allow me to point out some issues I've observed while reading your code (It is very clearly written, by the way.):

1) I wouldn't use threads that way. It may work with a single worker thread but you'll definitely run into every kind of concurrency problems if you spawn more than one worker thread. Also, as I've commented in the source code, while(Thread::IsOpen()) ProcessEvents(); is not a good way to handle threads. It goes against almost every purpose thread mechanism is here for. Smile What you achieved is a non-blocking application. But this doesn't mean that it is asynchronous. You should let worker threads work on their own and let them notify you when they're finisihed. That's why I suggested you read GuiMT example. Yet that example is very primitive. If you look for an actual application handling more than one threads, I'd like to suggest you reading the code of FtpBrowser example I wrote for my FTP class (you can find it here: http://www.ultimatepp.org/forums/index.php?t=msg&th=8899 &goto=43053&#msg_43053
While the example is purposefully somewhat crude, it can give you the idea on how to manage threads. Look into FtpAsyncIO() function and into the parts of FtpBrowser code.

2) U++ already has a csv parser. I modified your code. See main.cpp. Smile

3) You're using PostCallback somewhat excessively. While it is not wrong at all, you should separate Gui code from (sql) data processing, and call gui code only whenever it is necessary.

Also I'd like to point out that while GridCtrl is very flexible and great, there is a SqlCtrl which is very handy if you're aiming to use SQL with Grids/Arrays.

Regards,

Oblivion

  • Attachment: MTSQLTest.zip
    (Size: 13.10KB, Downloaded 217 times)


[Updated on: Sun, 14 May 2017 16:20]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Minor "mistake" in <CtrlLib/ArrayCtrl.h>
Next Topic: Insert Ctrl editors in a single row of ArrayCtrl
Goto Forum:
  


Current Time: Mon Apr 29 13:50:14 CEST 2024

Total time taken to generate the page: 0.02876 seconds