setTitle
Category: Window Management
Namespace: web.window.setTitle
Description
Sets the window title text. Changes apply immediately.
Syntax
const success = await web.window.setTitle({
title: 'My Application'
});
Parameters
- title (required) - New window title text
Returns
Promise<boolean> - Returns a promise that resolves with true if successful, false otherwise
Examples
Simple example
const success = await web.window.setTitle({
title: 'My Application v1.0'
});
if (success) {
console.log('Title updated');
}
Dynamic title with status
// Update title with current status
const status = 'Processing...';
await web.window.setTitle({
title: `My App - ${status}`
});
// Later, update when complete
await web.window.setTitle({
title: 'My App - Complete'
});
Show document name
// Update title when document changes
function updateTitle(documentName) {
const title = documentName ?
`My Editor - ${documentName}` :
'My Editor - Untitled';
web.window.setTitle({ title });
}
updateTitle('document.txt');
Use Cases
- Set application title dynamically
- Show current document or file name
- Display application status in title
- Update title based on user actions
- Show progress or notifications in title
Notes
- Changes apply immediately
- Sets the Caption property of the window
- Empty string is allowed
- Title appears in taskbar and window title bar