Home > Software engineering >  ListCtrl can insert the new data but cannot show that must be redrawn to switch the picture cause wi
ListCtrl can insert the new data but cannot show that must be redrawn to switch the picture cause wi

Time:09-30

Question is like this, I have a Tab dialog box below, and run up a Tab inside the Tab, and then after I receive the data in the serial port communication thread, send a message to the second Tab in the dialog List controls,

Debugging, I found in normal in a List control can insert data (communication, there is no problem), update the List of functions are realized in child dialogs OnPaint (began to no longer here, the result can't insert, I don't know what the reason is, there are a great god interpret it for me?) , and then the data can be inserted, but does not display the new data, it was only when I switch the Tab page (is actually cause the window to redraw), for example, I click the Tab page 2, point back, well, to refresh the data into the new, if I don't, or previous data,
Debugging, found that I got the serial data, order is send messages - dialog response function dialog OnPaint function - the List update function, (data not update the display), then switch back "switch" Tab page dialog re-paint, order is OnPaint - List update function, the order is the same, but so that you can refresh the List of data,
The great spirit show, what reason is this?

I tried many ways, in the main dialog box with the Invalid, this can be, but will blink (plus UpdateWindow also useless), this process is called the child dialogs OnPaint function, so the data will be updated (actually principle and switch the Tab, is lead to redraw OnPaint, but why receives the data for the first time, a serial port receiving data message function, the response function call OnPaint cannot refresh List?) ,

Also, child dialogs, I in the use of Invalid message response function is Invalid, I debug, child dialogs area does not happen is Invalid and re-paint,

CodePudding user response:

Add the UpdateData?

CodePudding user response:

The code analysis

CodePudding user response:

The Updatedata (true);

CodePudding user response:

Problem solved, it is a question of more exotic flower, again not experienced before, there is no problem now
  • Related