Пример #1
0
        public override void onSelect(string id, string text)
        {
            // Skip empty provider selections.
            if (text == "")
            {
                return;
            }

            sGlobal["$pref::SFX::provider"] = text;

            GuiPopUpMenuCtrl OptAudioDeviceList = "OptAudioDeviceList";

            OptAudioDeviceList.clear();

            string buffer = Util.sfxGetAvailableDevices();
            int    count  = Util.getRecordCount(buffer);

            for (int i = 0; i < count; i++)
            {
                string record   = Util.getRecord(buffer, i);
                string provider = Util.getField(record, 0);
                string device   = Util.getField(record, 1);

                if (provider != text)
                {
                    continue;
                }

                if (OptAudioDeviceList.findText(device) == -1)
                {
                    OptAudioDeviceList.add(device, i);
                }
            }
            // Find the previous selected device.
            int selId = OptAudioDeviceList.findText(sGlobal["$pref::SFX::device"]);

            if (selId == -1)
            {
                OptAudioDeviceList.setFirstSelected();
            }
            else
            {
                OptAudioDeviceList.setSelected(selId);
            }
        }
Пример #2
0
        public static void IODropdown(string title, string message, SimGroup simgroup, string callback, string cancelCallback)
        {
            ((GuiWindowCtrl)"IODropdownFrame").text = title;
            //bug GuiCanvas.pushDialog doesn't seem to work the mouse right.
            ((GuiCanvas)"Canvas").pushDialog("IODropdownDlg");
            MBSetText("IODropdownText", "IODropdownFrame", message);
            GuiPopUpMenuCtrl IODropdownMenu = "IODropdownMenu";

            if (simgroup.isObject())
            {
                for (uint i = 0; i < simgroup.getCount(); i++)
                {
                    IODropdownMenu.add(simgroup.getObject(i).getName());
                }
            }

            IODropdownMenu.sort();
            IODropdownMenu.setFirstSelected(false);
            ((GuiControl)"IODropdownDlg")["callback"]       = callback;
            ((GuiControl)"IODropdownDlg")["cancelCallback"] = cancelCallback;
        }