Problem
There are lots of event to react on listView events, but they are not clearly defined in the language reference or the DXL Manual.
Approach
This will show the most common events working with listView DBE elements.
Solution
void doSelect(DBE dbe, int idx) { // Auswahl mit Einfachklick } void doDeselect(DBE dbe, int idx) { // Element verliert selektion (evtl. durch anderes) } void doActivate(DBE dbe, int idx) { // Doppelklick / double click } void checkBoxReact(DBE lv, int i) { string s = get(lv, i) bool b = getCheck(lv, i) if ( b ) { int j=0; for(j=0;j<noElems(lv);j++) { if(i!=j) { setCheck(lv,j,false); } } //infoBox(s " was selected") } else { //infoBox(s " was deselected") } }
And this is how the ListView has been declared:
DB mainDialog=create("Select Baseline to compare"); DBE listViewBaselines = listView(mainDialog, listViewOptionCheckboxes,360,10,baselineEntries); // The first callback fires when an option is selected (a single click); // the second fires when an option is deselected (a side effect of a single click on another item); // the third fires when an item is activated (a double click). set(listViewBaselines,doSelect,doDeselect,doActivate); set(listViewBaselines, checkBoxReact); DBE publishButton=apply(mainDialog, "Compare", compareButtonCallBack); realize mainDialog; insertColumn(listViewBaselines, 0, "Baseline", 80, iconNone); insertColumn(listViewBaselines, 1, "Description", 140, iconNone); insertColumn(listViewBaselines, 2, "Increment", 140, iconNone); show mainDialog;