YAGQ - Yet another Grid Question Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
homerjaysimpson
Knows some wx things
Knows some wx things
Posts: 43
Joined: Wed Jan 16, 2008 9:06 am
Location: Cape Town, SA

YAGQ - Yet another Grid Question

Post by homerjaysimpson » Mon Jan 21, 2008 8:03 am

Hi folks,

I'm looking desperately for a solution for the following wxGrid problem: when I create a grid for let's say 1400 lines (via CreateGrid()), destroy it (via ClearGrid()) and then want to display another query set (for let's say 3200 entries), the Grid stops at 1400 lines. ClearGrid seems not to really wipe the lines. The Grid is not derived (so I have not derived a table either). Any suggestions ? Any help would be appreciated...

tan
Moderator
Moderator
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Re: YAGQ - Yet another Grid Question

Post by tan » Mon Jan 21, 2008 9:08 am

Hi,
homerjaysimpson wrote:Hi folks,

I'm looking desperately for a solution for the following wxGrid problem: when I create a grid for let's say 1400 lines (via CreateGrid()), destroy it (via ClearGrid()) and then want to display another query set (for let's say 3200 entries), the Grid stops at 1400 lines. ClearGrid seems not to really wipe the lines. The Grid is not derived (so I have not derived a table either). Any suggestions ? Any help would be appreciated...
try this to clear all rows:

Code: Select all

     grid->DeleteRows(0, grid->GetNumberRows());
And use BeginBatch()/EndBatch() to reduce screen flicker.
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10

homerjaysimpson
Knows some wx things
Knows some wx things
Posts: 43
Joined: Wed Jan 16, 2008 9:06 am
Location: Cape Town, SA

Post by homerjaysimpson » Mon Jan 21, 2008 1:19 pm

Thank you very much, now the rows are deleted correctly but when I then call CreateGrid() another time, no other row is added. What am I doing wrong here ?

tan
Moderator
Moderator
Posts: 1471
Joined: Tue Nov 14, 2006 7:58 am
Location: Saint-Petersburg, Russia

Post by tan » Mon Jan 21, 2008 3:06 pm

homerjaysimpson wrote:Thank you very much, now the rows are deleted correctly but when I then call CreateGrid() another time, no other row is added. What am I doing wrong here ?
Well, why do you call CreateGrid() another time? You don't have to do it after DeleteRows(...), just add some others rows.
OS: Windows XP Pro
Compiler: MSVC++ 7.1
wxWidgets: 2.8.10

timg
Earned some good credits
Earned some good credits
Posts: 148
Joined: Mon Jan 23, 2006 6:52 pm

Post by timg » Mon Jan 21, 2008 5:20 pm

You don't want to call CreateGrid again.

Just call AppendRows(NumOfRows) on the grid you already have (after you delete the exisiting rows as suggested above)

homerjaysimpson
Knows some wx things
Knows some wx things
Posts: 43
Joined: Wed Jan 16, 2008 9:06 am
Location: Cape Town, SA

Solved

Post by homerjaysimpson » Tue Jan 22, 2008 7:45 am

Thank you very much, that did the trick. So I can only call CreateGrid exactly one time then ? What's that for ?

Post Reply