LensStudio:Ui.MessageBox.Icon
EnumIcon enumeration for message box dialogs.
Index
Enumeration Members
Example
export class MessageBoxIconPanel extends PanelPlugin {
connections: any[];
static descriptor() {
const d = new Descriptor();
d.id = 'com.docs.UiMessageBoxIconExample';
d.name = 'MessageBox Icon Example';
d.defaultDockState = DockState.Detached;
d.defaultSize = new Size(350, 250);
return d;
}
constructor(pluginSystem: Editor.PluginSystem, descriptor?: Descriptor) {
super(pluginSystem, descriptor);
this.connections = [];
}
createWidget(parent: Widget): Widget {
const root = new Widget(parent);
const layout = new BoxLayout();
layout.setDirection(Direction.TopToBottom);
layout.spacing = 8;
root.layout = layout;
const title = new Label(root);
title.text = 'MessageBox.Icon Enum';
title.fontRole = FontRole.TitleBold;
layout.addWidget(title);
// MessageBox.Icon values: NoIcon, Information, Warning, Critical, Question
const icons: [string, () => void][] = [
['Information', () => {
MessageBox.information('Info', 'Informational message.',
MessageBox.StandardButton.Ok as unknown as MessageBox.StandardButtons,
MessageBox.StandardButton.Ok);
}],
['Warning', () => {
MessageBox.warning('Warning', 'Warning message.',
MessageBox.StandardButton.Ok as unknown as MessageBox.StandardButtons,
MessageBox.StandardButton.Ok);
}],
['Critical', () => {
MessageBox.critical('Error', 'Critical error occurred.',
MessageBox.StandardButton.Ok as unknown as MessageBox.StandardButtons,
MessageBox.StandardButton.Ok);
}],
['Question', () => {
MessageBox.question('Question', 'Are you sure?',
MessageBox.StandardButton.Yes as unknown as MessageBox.StandardButtons,
MessageBox.StandardButton.Yes);
}],
];
for (const [label, handler] of icons) {
const btn = new PushButton(root);
btn.text = 'Show ' + label;
layout.addWidget(btn);
this.connections.push(btn.onClick.connect(handler));
}
return root;
}
deinit(): void {
this.connections.forEach((c: any) => c?.disconnect());
this.connections = [];
}
}
Enumeration Members
Critical
Critical:
number
Critical/error icon.
Information
Information:
number
Information icon.
NoIcon
NoIcon:
number
No icon displayed.
Question
Question:
number
Question icon.
Warning
Warning:
number
Warning icon.