'KCMLSetTitleTemplate(sFormat$)
Set a title template to be used on all subsequent top level forms.
Arguments
STR() | sFormat$ | [in] | Format string defining the new title. |
Returns
This function returns TRUE on success, or FALSE on failure.
Syntax
The following definition is built into KCML. You do not have to include it in your own code.
$DECLARE 'KCMLSetTitleTemplate(STR())
Remarks
This function sets a title template to be used on all subsequent top level forms taking precedence over the normal .form.text$ title. The template can contain tokens which will be replaced by strings.
Token | Replacement string |
---|---|
%T | The forms proper title |
%H | The server hostname, blank if a local connection |
%S | The connection manager service, blank if not connected through the CM |
%U | The userid used to connect to the server, blank if a local connection |
%C | Force the template to be applied to child forms as well as top level forms |
Setting a blank or empty string will disable the template and subsequent titles will be shown unmodified. If the template is changed with this function, it will take effect with the opening of the next top level form or on the next change of the title of the current top level form by setting its .text$ property.
Example
The title of all forms will be modified to append the current company selected in a multicompany accounting system. Note the %% to protect the % in $PRINTF.
$DECLARE 'KCMLSetTitleTemplate(STR()) t$ = $PRINTF("%%T - Company %d", company_no) 'KCMLSetTitleTemplate(t$)
Sample program
DIM rc - DEFFORM Form1()={.form,.form$,.Style=0x50c000c\ 4,.Width=276,.Height=130,.Text$="Original title"\ ,.Id=1024},{.ok,.button$,.Style=0x50010\ 001,.Left=220,.Top=6,.Width=50,.Height=14,.Text$\ ="OK",.__Anchor=5,.Id=1},{.Cancel,.button$,.Styl\ e=0x50010000,.Left=220,.Top=23,.Width=5\ 0,.Height=14,.Text$="Cancel",.__Anchor=5,.Id=2},\ {.Help,.button$,.Style=0x50010000,.Left=206,.Top\ =82,.Width=63,.Height=14,.Text$="&Reset\ title",.__Anchor=4,.Id=9},{.cmdButton1,.button$\ ,.Style=0x50010000,.Left=206,.Top=106,.Width=63,\ .Height=14,.Text$="&Set template",.__An\ chor=4,.Id=1000,.Click()},{.editControl1,.kcmldb\ edit$,.Style=0x50810080,.Left=20,.Top=83,.Width=\ 153,.Height=13,.__Anchor=2,.Id=1001},{.\ editControl2,.kcmldbedit$,.Style=0x50810080,.Lef\ t=20,.Top=106,.Width=153,.Height=13,.__Anchor=2,\ .Id=1002},{.textControl1,.static$,.Styl\ e=0x50000000,.Left=15,.Top=12,.Width=189,.Height\ =67,.Text$="Click Reset Title to change the titl\ e programmatically.....Click SetTemplat\ e to use a template. Use %T to insert title tex\ t. A blank template will revert.....When you cl\ ick OK a second form will appear and th\ e template should persist into it.",.Id=1003},{.\ frameControl1,.groupbox$,.Style=0x50000007,.Left\ =8,.Top=3,.Width=203,.Height=71,.Id=100\ 4} + DEFEVENT Form1.Enter() REM fill in the defaults .editControl1.Text$ = .form.Text$ .editControl2.Text$ = "%T - template active" END EVENT + DEFEVENT Form1.Help.Click() REM set title programmatically .form.Text$ = .editControl1.Text$ END EVENT + DEFEVENT Form1.cmdButton1.Click() REM set template 'KCMLSetTitleTemplate(.editControl2.Text$) END EVENT FORM END Form1 rc = Form1.Open() REM prove it persists + DEFFORM Form2()={.form,.form$,.Style=0x50c000c\ 4,.Width=216,.Height=94,.Text$="Second form",.Id\ =1024},{.ok,.button$,.Style=0x50010001,\ .Left=160,.Top=6,.Width=50,.Height=14,.Text$="OK\ ",.__Anchor=5,.Id=1},{.Cancel,.button$,.Style=0x\ 50010000,.Left=160,.Top=23,.Width=50,.H\ eight=14,.Text$="Cancel",.__Anchor=5,.Id=2},{.He\ lp,.button$,.Style=0x50010000,.Left=160,.Top=44,\ .Width=50,.Height=14,.Text$="&Reopen th\ is",.__Anchor=5,.Id=9,.Click()},{.textControl1,.\ static$,.Style=0x50000000,.Left=21,.Top=15,.Widt\ h=123,.Height=63,.Text$="Any template s\ hould have persisted into this form.....You can \ use the Reopen button to open this form again as \ a child of this one. The template sho\ uld NOT persist into this form...",.Id=1000} + DEFEVENT Form2.Help.Click() REM open a child form Form2.Open() END EVENT FORM END IF (rc) Form2.Open() END IF
Further Information
Introduced | KCML 5.00 |
Compatibility | Browser Client KClient |
See Also
KCMLAddNotifyIcon, KCMLDeferHiddenControls, KCMLDlgMessageBox, KCMLEnableBufferKeys, KCMLEnableDropdownPreFill, KCMLEnableModalPopups, KCMLForceChromium, KCMLGetBufferKeys, KCMLGetChromiumShimVersion, KCMLGetChromiumVersion, GetLocalTime, KCMLGetWindow, KCMLHideErrorDialogs, KCMLHookIEOCX, MessageBox, KCMLRemoveNotifyIcon, KCMLSetBrowserDebugPort, KCMLSetBufferKeyBreakKey, KCMLSetBufferKeyTimeout, KCMLSetBufferKeys, KCMLSetCenturyThreshold, KCMLSetChromiumAcceptLang, KCMLSetDollarConvert, KCMLSetHTMLCtrlRelativeURL, KCMLTouchScreenMode