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   |
Oblivion
Messages: 1206 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. 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. 
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
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Sun, 14 May 2017 16:20] Report message to a moderator
|
|
|
 |
|
Select Grid Row BY ID
By: germax on Fri, 05 May 2017 19:32
|
 |
|
Re: Select Grid Row BY ID
By: deep on Mon, 08 May 2017 15:07
|
 |
|
Re: Select Grid Row BY ID
|
 |
|
Re: Select Grid Row BY ID
By: germax on Wed, 10 May 2017 12:33
|
 |
|
Re: Select Grid Row BY ID
|
 |
|
Re: Select Grid Row BY ID
By: germax on Thu, 11 May 2017 03:33
|
 |
|
Re: Select Grid Row BY ID
|
 |
|
Re: Select Grid Row BY ID
By: germax on Thu, 11 May 2017 20:17
|
 |
|
Re: Select Grid Row BY ID
|
 |
|
Re: Select Grid Row BY ID
By: germax on Fri, 12 May 2017 02:20
|
 |
|
Re: Select Grid Row BY ID
|
 |
|
Re: Select Grid Row BY ID
By: germax on Sat, 13 May 2017 19:13
|
 |
|
Re: Select Grid Row BY ID
|
 |
|
Re: Select Grid Row BY ID
By: germax on Sun, 14 May 2017 19:48
|
 |
|
Re: Select Grid Row BY ID
By: JeyCi on Thu, 18 February 2021 14:45
|
 |
|
Re: Select Grid Row BY ID
By: JeyCi on Fri, 19 February 2021 07:31
|
 |
|
Re: Select Grid Row BY ID
By: deep on Mon, 15 May 2017 07:44
|
 |
|
Re: Select Grid Row BY ID
By: germax on Mon, 15 May 2017 14:22
|
Goto Forum:
Current Time: Sat May 10 23:20:39 CEST 2025
Total time taken to generate the page: 0.02208 seconds
|