Icon enumeration for message box dialogs.
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 = []; }} Copy
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 = []; }}
Critical/error icon.
Information icon.
No icon displayed.
Question icon.
Warning icon.
Icon enumeration for message box dialogs.
Example