The toggle button in the layer panel is initialized with the bits of the variable ui_layerStartValue. Bit 0 corresponds to layer 1, bit 1 to layer 2, etc. Because the layer panel yields a value, X has to display the panel and allow user input before the program is continued (just like it was the case with the confirmer). The result is available in the variable ui_layerReturnValue.