Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » Select Grid Row BY ID
Re: Select Grid Row BY ID [message #48016 is a reply to message #48009] |
Mon, 08 May 2017 19:09 |
Oblivion
Messages: 1093 Registered: August 2007
|
Senior Contributor |
|
|
Quote:
if I use the rows preset ID (grid.AddIndex(ID)Wink
and accessing the row by ID (int rownum = grid.Find(rowid, ID); grid.GetRow(rownum))
the program compiles flawlessly but terminates with a runtime error
(I assume the row Id changes during execution since a concurrent thread deletes a row)
it's a sheer PITA to not being able to just grid[rowid].doStuff() with a ficxed rowid not irritated by sortorder or number of rows or position of row on the grid...
So let me get this straight:
You are trying to access and manipulate a Grid object (in which you store some information) from within worker threads, right?
If this is the case, the first rule you need to remember is that GUI related stuff in U++ should be done in the main thread.
Hence you'll need serialized access. And if you want serialized access to gui elements from within threads, you should consider using PostCallback() function.
GuiMT example in the U++ reference examples in principle demonstrates this behaviour.
E.g.
If you are going to do stuff in a Grid, you can:
// Let us assume that we've defined a Grid object as grid in MyApp;
// Then in your worker thread you can call PostCallback().
// Of course you'll need a more complicated version of control code,
//WorkerFoo() represents a worker thread function.
MyApp::WorkerFoo()
{
auto rowid = 1;
PostCallback( [&] { grid(rowid).DoStuff(); } );
}
Of course you need to design your code keeping in mind that removing elements from arrayctrls and grids invalidate references and pointers. (see docs and examples)
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: Mon, 08 May 2017 19:42] 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 14:44:15 CEST 2024
Total time taken to generate the page: 0.01592 seconds
|