Colour Picker Example

dialogs15

This simple example shows how to build a colour picker as can be seen in the enumerated attribute editor.

DB  dbMain        = null
DBE dbeColourList = null

const int maxRealColour = 35

string realColourNames[maxRealColour + 1] = {} 

string realName = ""

int i = 0

for (i = 0; i <= maxRealColour; i++)
{
    realColourNames[i] = getRealColourName(i)
}

dbMain = create(dbExplorer, "Colour Picker Example")

dbeColourList = listView(dbMain, 40, 200, 10, realColourNames)

realize dbMain

insertColumn(dbeColourList, 0, "Colour", 180, iconNone)

Icon theIcon
for (i = 0; i <= maxRealColour; i++)
{

    theIcon = getRealColourIcon(i)
    set(dbeColourList, i, 0, theIcon)

}

show(dbMain)