المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : ListBox redrawing



C++ Programming
01-31-2010, 09:13 AM
I'm new here, please bear with me.

I'm not sure if this is the appropriate place to put it, as my question is regarding C++, but for OWL rather than MFC. Anyways, down to the problem:

I'm maintaining some legacy code which involves a multi-line listbox. The contents of this listbox are loaded in through the EvDrawItem function. The EvDrawItem gets called repeatedly. While selecting an object, the cells in the listbox are selected one at a time too, and we are manually painting it in (not sure if this is the right way to do it). This becomes noticeable only when the items are long.

Now, here's the biggest part of the problem: when double-clicking on an item, we are supposed to pop up an edit box. While this does happen, the double-clicking is seen to cause the item to do cycles of "select, select, de-select, select"...about 50 (each cycle is made up of 4 EvDrawItems) times (is this normal???).

With some research, I do feel that I should probably make use of the setredraw and invalidate functions, but I'm not sure where's the best place to put these codes in so that they propagate through the rest of the program where similar listboxes are used.

Also, since the draw and the insertions are handled together, would suppressing redraw affect how the list loads up?

modified on Friday, January 29, 2010 2:45 PM