



Include “Mapbasic.def”
Include “Menu.def”
‘Defines——————————————-
Define SET_ALIAS_TXTBOX 1Define SET_TITLE_TXTBOX 1
‘Sub Routines—————————————
Declare Sub Main
Declare Sub SetLayoutWindowTitleDialog
Declare Sub ValidateSetLayoutWindowTitleDialog
Declare Sub SetWindowTitle(ByVal strVal as String)
‘————————————————————————————————-
Sub Main
OnError Goto CatchEx
‘Layout Window Right Click Menu
Alter Menu ID M_SHORTCUT_LAYOUT Add
“(-“, “Set Window Title…”
HelpMsg “\nSet Window Title”
Calling SetLayoutWindowTitleDialogDone:
Exit Sub
CatchEx:
Note Error$()
Resume Done
End Sub
‘————————————————————————————————-
Sub SetLayoutWindowTitleDialog
OnError Goto CatchEx
Dim strWindowTitle as String
strWindowTitle = WindowInfo(FrontWindow(), WIN_INFO_NAME)
Dialog
Title “Set Layout Window Title”
Width 250 Height 30
Control EditText
Position 10,10
Width 150
Value strWindowTitle
ID SET_TITLE_TXTBOX
Into strWindowTitle
Control OKButton
Position 165, 8.5
Title “Set”
Calling ValidateSetLayoutWindowTitleDialog
Control CancelButton
Position 205, 8.5
If CommandInfo(CMD_INFO_DLG_OK) then
Call SetWindowTitle(strWindowTitle)
End If
Done:
Exit Sub
CatchEx:
Note Error$()
Resume Done
End Sub
‘————————————————————————————————-
Sub ValidateSetLayoutWindowTitleDialog
OnError Goto CatchEx
If ReadControlValue(SET_ALIAS_TXTBOX) = “” then
Note “You must enter a Window Title”
Dialog Preserve
Goto Done
End If
Done:
Exit Sub
CatchEx:
Note Error$()
Resume Done
End Sub
‘————————————————————————————————-
Sub SetWindowTitle(ByVal strVal as String)
OnError Goto CatchEx
Set window FrontWindow() Title strVal
Done:
Exit Sub
CatchEx:
Note Error$()
Resume Done
End Sub
Bình luận bằng Facebook Comments