Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Select Grid Row BY ID
Re: Select Grid Row BY ID [message #48028 is a reply to message #48025] |
Thu, 11 May 2017 20:04 |
Oblivion
Messages: 1093 Registered: August 2007
|
Senior Contributor |
|
|
Hello germax, and you're welcome.
Ultimate++ forums are full of helpful people.
Quote:Your example is just what I wanted.. it doesn't explain to me why mine didn't work,
but all I care about now is that it DOES work one way or another Very Happy so I'm good.
Sorry I forgot to write that, The reason is actually pretty simple. You use CoWork::Finish(), which is blocking.
You should have used CoWork::IsFinished() instead.
In that case, all you need to call is Ctrl::ProcessEvents(). But still, CoWork seems to me an overkill here.
All you need to do is to alter your code as below (Of course you don't need to use lambda functions and while in the example accessing the vector from threads does not pose classic conncurrency problems, you should consider using mutex (CoWork::Finlock() will do fine. See docs and tutorials for more explanation.):
void MTT::processFile()
{
int rowc = grid.GetRowCount();
Vector<bool> del;
del.SetCount(rowc, false);
progin.SetTotal(rowc);
progin.Percent();
for(int i=0; i < rowc; i++)
cw & [=, &del] {
// Now, this isn't the proper way to accaess shared elements (UI or core) from a
// thread. But ONLY in this example, it won't do harm.
grid.GetRow(i);
int q = grid(i,2);
if(q <= 0)
// CoWork::FinLock();
del.Set(i, true);
};
// cw.Finiehed()
// Non blocking way:
while(!cw.IsFinished())
ProcessEvents();
for(int i = rowc-1; i>=0; i--)
{
progin++;
if(del[i]) grid.Remove(i);
ProcessEvents();
}
RDUMP(del);
}
This is all you need to do.
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: Thu, 11 May 2017 20: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: Mon Apr 29 12:04:42 CEST 2024
Total time taken to generate the page: 0.02532 seconds
|