Trouble populating ListView item

I am trying to create a dialog that contains a listView of all baselines for the currently open module.  However, I am receiving the error: Dialog box not realized - use function in a callback

Here are the functions I've created:

DB main;
DBE dbeBaselineSelect;
Module currMod = current Module;

void fillBaselinesList() {
    Baseline b = null;
    int index = 0;
    
    for b in currMod do {
        insert(dbeBaselineSelect, index, major(b) "." minor(b) " " suffix(b), iconNone);
        index++;
    }
    insert(dbeBaselineSelect, index, "Current", iconNone;)
}

void buildDialog() {
    dbMain = create(currMod, "ShowDXLAttribCode", styleCentered|styleFixed);
    
    dbeBaselineSelect = listView(dbMain, 0, 340, 14, dummy);
    //(Add code to position listView within the GUI)
    
    fillBaselinesList();
}

I am getting the error on the first insert (within the for loop).  I'm not sure what the problem is with this code.  I have used similar code in other dialog boxes and it works fine.  I'm hoping someone can see where I went wrong with this code snippet.  If more is needed, please let me know and I will add it.


chrscote - Mon Nov 27 10:13:48 EST 2017

Re: Trouble populating ListView item
pommCannelle - Wed Nov 29 05:48:42 EST 2017

Hi ! 

( use dbMain everywhere, add a column in your listView and add a realize of your main DB ... )
i let you check if the column exists before to add it if you need to fill it more than once ;)

DB dbMain;
DBE dbeBaselineSelect;
Module currMod = current Module;

void fillBaselinesList() {
    insertColumn(dbeBaselineSelect, 1, "Baselines", 320, null)
    Baseline b = null;
    int index = 0;
    
    for b in current Module do {
        insert(dbeBaselineSelect, index, major(b) "." minor(b) " " suffix(b), iconNone);
        index++;
    }
    insert(dbeBaselineSelect, index, "Current", iconNone;)
}

void buildDialog() {
    dbMain = create(currMod, "ShowDXLAttribCode", styleCentered|styleFixed);
    
    dbeBaselineSelect = listView(dbMain, 0, 340, 14, dummy);
    //(Add code to position listView within the GUI)
    
    realize(dbMain ){ fillBaselinesList() }
}

Enjoy ;)