Search code examples
c++wxwidgets

wxwidgets fast regular data update


I want to update list's row or grid's cell in wxwidgets using a loop or with a callback function which is called 10 times in a second. But app waits until the last run of the loop and then shows the last value. I tried refresh() and ForceRefresh() but it doesn't work. how can I achieve this?

for(int i=0; i< 30000; i++) {
   list->SetItem(itemIndex, 0, wxString::Format(wxT("%i"),i));
   //grid->SetCellValue( 0, 0, wxString::Format(wxT("%i"),i));
}

Edit: What I mean is outputting(printing, streaming) data live like a clock counter or printing progress rate. Using virtual style also does not update it often enough.


Solution

  • Well I got the complete answer from wxWidgets IRC. I should have refreshed before updating.

    for(int i=0; i< 30000; i++) {
      list->SetItem(itemIndex, 0, wxString::Format(wxT("%i"),i));
      //grid->SetCellValue( 0, 0, wxString::Format(wxT("%i"),i));
      MyFrame::Refresh();
      MyFrame::Update();
    }