List control borders flickers when custom list dialog filtering

Is there any solution?
ListDialogFilterFlicker

Some (minimal) code to show what you are doing is essential here, else we have to do pure guesswork.

Well, I've been asking about this custom dialog lately.

function OnClick(clickData)
{

    var strValue;
    var strName;

    var dlg = DOpus.Dlg;

    dlg.title = "Directory Opus";
    dlg.template = "dlgList";
    dlg.detach = true;
    dlg.Create();
	dlg.Control("static").label = "Topic";                                  // Topic
	dlg.Control("static2").label = "Notes";                                 // Notes
	dlg.Control("static3").label = "D:\\Icons\\Everything.ico";             // Icon
	dlg.Control("static4").label = "D:\\Icons\\Find.png";                   // Icon
	dlg.Control("static5").label = "D:\\Icons\\Clear.png";                  // Clear

    updateList(dlg, strName, strValue);

    dlg.Show();

	var lst = dlg.Control("list");
	var col = lst.columns;



    while (true) {
        var msg = dlg.GetMsg();
        if (!msg.result) break;

// Result
        if(msg.event == "focus" || dlg.Control("btnOK").focus == true) {
		   var items = "";
           for (i=0; i < lst.count; i ++) {
                if (lst.GetItemAt(i).checked == 1) {
				    items += lst.GetItemAt(i).name;
					items+= "\r\n";
                }
            }
		}

// Right click list menu
        if (msg.event == "rclick" && lst.focus == true) {

            var dlgMenu = DOpus.Dlg;
            if (lst.value.index > -1) {
                //dlgMenu.choices = DOpus.Create.Vector("Edit...", "Delete", "-", "Select Variable", "Deselect Variable", "-", "Select All", "Select None", "-", "Copy Name", "Copy Value", "-", "Clear Filter", "Refresh");
				dlgMenu.choices = DOpus.Create.Vector("OK", "Cancel");
                //dlgMenu.menu = DOpus.Create.Vector(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
				dlgMenu.menu = DOpus.Create.Vector(1, 1);
            }
            else {
                //dlgMenu.choices = DOpus.Create.Vector("New...", "Delete", "-", "Select Variable", "Deselect Variable", "-", "Select All", "Select None", "-", "Copy Name", "Copy Value", "-", "Clear Filter", "Refresh");
				dlgMenu.choices = DOpus.Create.Vector("OK", "Cancel");
                dlgMenu.menu = DOpus.Create.Vector(1,1);
            }
            var menuReturn = dlgMenu.Show;
			DOpus.Output(menuReturn);
        }

// Filter
		if (msg.event == "editchange" || msg.event == "click") {
			updateList(dlg, strName, strValue);
		}

    }

// Output result
	if(items != "" && dlg.result == 1) {
	   var array = items.split("\r\n");
       for (i=0; array[i]; i ++) {
			DOpus.Output(array[i]);
        }
	}
}



function updateList(dlg, strName, strValue) {

    var lst = dlg.Control("list");
	var col = lst.columns;
/*
// Add columns
    if (col.GetDisplayOrder() != "1, 0") {
	    col.AddColumn("0:Name");
	    col.AddColumn("1:Index");
	}
*/
    lst.RemoveItem(-1);

// List items
    var text = "name1, name2, name3, name4, name5, name6, name7, name8, name9, name10, name11, name12, name13, name14, name15, name16, name17, name18, name19, name20, name21, name22, name23, name24, name25, name26, name27, name28, name29, name30, name31, name32, name33, name34, name35";
	var myArray = text.split(", ");                           // Seprator
	
	var idx;
    for(i = 0; myArray[i]; i++) {
        strName = myArray[i];
		var strRealName = myArray[i];
		
		var strFilter = dlg.Control("editFilter").value;      // Get filter value
		strFilter = strFilter.toLowerCase();

		if (strRealName.search(strFilter) == -1) {
			continue;
		}

        idx = lst.AddItem(strName);                           // Add each item to list
		lst.GetItemAt(idx).subitems(0) = i+1;                 // Add number to column 1 (Index)

		strRealName = "";
		strFilter = "";
    }

// Set the columns display order
	if (false)
	{
	    //col.SetDisplayOrder(1,0,2);
	}

    col.AutoSize();
}



==SCRIPT RESOURCES
<resources>
	<resource name="dlgList" type="dialog">
		<dialog fontsize="9" height="350" lang="english" resize="yes" title="Directory Opus" width="279">
			<control halign="left" height="12" name="editFilter" resize="w" tip="Filter" type="edit" width="118" x="25" y="331" />
			<control checkboxes="auto" fullrow="yes" height="287" name="list" noheader="yes" resize="wh" type="listview" viewmode="details" width="266" x="6" y="40">
				<columns>
					<item text="Name" />
					<item text="Index" />
				</columns>
			</control>
			<control close="1" default="yes" height="12" name="btnOK" resize="xy" title="&amp;OK" type="button" width="42" x="184" y="332" />
			<control close="0" height="12" name="btnClose" resize="xy" title="C&amp;ancel" type="button" width="42" x="229" y="332" />
			<control halign="left" height="8" name="static" title="Topic" type="static" valign="top" width="236" x="33" y="7" />
			<control halign="left" height="13" image="yes" name="static3" title="Static" type="static" valign="top" width="13" x="7" y="5" />
			<control halign="left" height="13" image="yes" name="static4" title="Static" type="static" valign="top" width="13" x="8" y="330" />
			<control halign="left" height="16" name="static2" title="Notes" type="static" valign="top" width="236" x="33" y="20" />
			<control halign="left" height="5" name="static5" title="Static" type="static" valign="top" width="6" x="134" y="335" />
		</dialog>
	</resource>
</resources>

It looks like your filtering is removing everything from the list and then adding in the items that match the filter, on every keypress.

The solution is to only add/remove things as needed.

I tried removing mismatched items 20 minutes ago, same.

I tested again and it seems to happen sometimes.

You want to avoid the lst.RemoveItem(-1);, and only add things that are missing (and now match the filter) and remove things which are present (and no longer match the filter).

That will reduce the flicker greatly.

We also plan to provide a way to tell the control to stop re-drawing while you're modifying it, and then redraw everything once at the end. That will let you hide any/most flicker. But, even with that, it will still probably be faster to only change the items that need changing, rather than rebuilding the whole list, and may also avoid resetting the list's scroll position each time a character is typed into the filter.

Even only add/remove, the list will scroll and it doesn't look good. It would be nice if the flickering could be solved, maybe modify the color of the borders? . . .
Eidt :

We also plan to provide a way to tell the control to stop re-drawing while you're modifying it, and then redraw everything once at the end. That will let you hide any/most flicker. But, even with that, it will still probably be faster to only change the items that need changing, rather than rebuilding the whole list, and may also avoid resetting the list's scroll position each time a character is typed into the filter.

That's good, many thanks!

The thing I mentioned that we will add will stop any remaining flicker. (Or at least greatly reduce it.)