BUI logoBBjWebManager::setTitle

Description

In BBj 17.00 and higher, this method updates the browser title for the current page.

Note:

In BBj 22.03 and higher, BBjWebManager is an alias for BBjBuiManager.

Syntax

Return Value Method
void setTitle(string title)
void setTitle(string title, string format)
void setTitle(string title, string format, Map placeholders)

Parameters

Parameter Description
title Browser title.
format In BBj 23.06 and higher, this specifies a format string to dynamically combine the {BrowserTitle}, the current active {WindowTitle}, and optional developer-defined placeholder text.
placeholders In BBj 23.06 and higher, this structure defines any additional variables to be included in the formatted title.

Return Value

None.

Remarks

The browser title is also updated whenever a new top level window is added, and by BBjTopLevelWindow::setTitle.

Example

rem ' BBjWebManager::setTitle

sysgui = unt
open (sysgui)"X0"
sysgui! = bbjapi().getSysGui()
browser! = bbjapi().getWebManager()

window! = sysgui!.addWindow(25,25,550,300,"setTitle",$00090083$)
window!.setCallback(window!.ON_RESIZE,"resize")
window!.setCallback(window!.ON_CLOSE,"eoj")

setWindowTitle! = window!.addButton(101,25,25,150,25,"Set Window Title",$$)
setWindowTitle!.setCallback(setWindowTitle!.ON_BUTTON_PUSH,"setWindowTitle")
windowTitle! = window!.addEditBox(102,200,25,300,25,window!.getTitle(),$$)

setBrowserTitle! = window!.addButton(103,25,75,150,25,"Set Browser Title",$$)
setBrowserTitle!.setCallback(setBrowserTitle!.ON_BUTTON_PUSH,"setBrowserTitle")
browserTitle! = window!.addEditBox(104,200,75,300,25,browser!.getTitle(),$$)

window!.addStaticText(105,25,125,150,25,"Title Format:",$8000$)
format$ = "" + $0a$
format$ = format$ + "{BrowserTitle} - {WindowTitle}" + $0a$
format$ = format$ + "{WindowTitle} - {BrowserTitle}" + $0a$
format$ = format$ + "{BrowserTitle} {WindowTitle ? '- ' + WindowTitle : ''}" + $0a$
format$ = format$ + "{BrowserTitle} - {WindowTitle} - {a}" + $0a$
format$ = format$ + "{BrowserTitle} - {WindowTitle} - {a} {b}" + $0a$
format$ = format$ + "{BrowserTitle} - {WindowTitle} - {a} {b} {c}" + $0a$
titleFormat! = window!.addListEdit(106,200,125,300,200,format$,$$)

getBrowserTitle! = window!.addButton(107,25,175,150,25,"Get Browser Title",$$)
getBrowserTitle!.setCallback(getBrowserTitle!.ON_BUTTON_PUSH,"getBrowserTitle")
title! = window!.addEditBox(108,200,175,300,25,browser!.getTitle(),$0200$)

showDialog! = window!.addButton(109,25,225,150,25,"Show Dialog",$$)
showDialog!.setCallback(showDialog!.ON_BUTTON_PUSH,"showDialog")

context = window!.getContextID()
sysgui!.setContext(sysgui!.getAvailableContext())
dialog! = sysgui!.addWindow(100,100,150,100,"Dialog",$00090093$)
dialog!.setCallback(dialog!.ON_CLOSE,"hideDialog")
sysgui!.setContext(context)

process_events

eoj:
  release

resize:
  event! = sysgui!.getLastEvent()
  width = event!.getWidth() - 225
  height = event!.getHeight()
  windowTitle!.setSize(width,windowTitle!.getHeight())
  browserTitle!.setSize(width,browserTitle!.getHeight())
  titleFormat!.setSize(width,titleFormat!.getHeight())
  title!.setSize(width,title!.getHeight())
return

setWindowTitle:
  window!.setTitle(windowTitle!.getText())
return

setBrowserTitle:
  format$ = titleFormat!.getText().trim()
  map! = new java.util.HashMap()
  map!.put("a","1")
  map!.put("b","2")
  map!.put("c","3")
  browser!.setTitle(browserTitle!.getText(),format$,map!)
return

getBrowserTitle:
  title!.setText(browser!.getTitle())
return

showDialog:
  dialog!.setVisible(1)
return

hideDialog:
  dialog!.setVisible(0)
  window!.focus()
return

ClosedVersion History

  • BBj 24.01: Added optional format and Map arguments for BBjWebManager::setTitle

See Also

BBjAPI

BBjWebManager::getTitle

See the BBj Object Diagram for an illustration of the relationship between BBj Objects.