package require java
set messager [ java::call com.surpac.client.ClientManager getMessager ]
GuidoForm MessageOptions {
-default_buttons
-label "Message Options"
-tip "MESSAGEOPTIONS_TIP_001"
-layout BoxLayout Y_AXIS
-help_id 926
GuidoPanel main {
-layout CentreLineLayout
GuidoCheckBox show_debug {
-label "Enable debug messages"
-tip "Displays debug messages in the message window if ticked."
}
GuidoCheckBox show_informational {
-label "Enable informational messages"
-tip "Displays informational messages in the message window if ticked. This should be enabled by default."
}
GuidoCheckBox show_warning {
-label "Enable warning messages"
-tip "Displays warning messages in the message window if ticked. This should be enabled by default."
}
GuidoCheckBox beep_on_error {
-label "Beep for error messages"
-tip "Sounds the default error noise when an error occurs if ticked."
}
GuidoCheckBox use_report_dialog {
-label "Use separate window for report messages"
-tip "REPORT_WINDOW_CONFIG_TIP"
}
GuidoPanel panel_1 {
-label "Message window buffer size"
GuidoField buffer_size {
-format integer
-max_length 4
-display_length 6
-tip "The number of lines of messages retained in the message window."
}
}
}
GuidoFiller space {
-height 0.5
}
GuidoPanel logging {
-layout CentreLineLayout
-label "Message Log"
-border etched true
GuidoCheckBox log_to_file {
-label "Log to file"
-tip "Tick this box to enable the logging to file of all messages shown in the Message Log window."
}
GuidoPanel panel_2 {
-label "Log file path"
GuidoFileBrowserField file_browser {
-file_access write
-file_mask *.log
-tip "00207_TIP_011"
-display_length 20
-dependency {"[ $log_to_file getCurrentValue]" == "true"}
}
}
}
GuidoFiller space {
-height 0.5
}
GuidoPanel button_panel {
-layout boxLayout X_AXIS
GuidoFiller space {
-width 1
}
GuidoButton clear_window {
-caption "Clear Window"
-selected_value ClearBuffer
-action valueChanged {[$messager clearBuffer]}
-height 1
}
GuidoFiller space {
-width 1
}
GuidoButton clear_file {
-caption "Clear log file"
-selected_value ClearLogFile
-height 1
-dependency {"[ $log_to_file getCurrentValue]" == "true"}
-action valueChanged {[$messager clearLogFile]}
}
}
GuidoFiller space {
-height 0.5
}
}
proc boolean { int } {
if { $int == "0" } {
return "false"
}
return "true"
}
$show_debug setCurrentValue [ boolean [ $messager isDebugEnabled ] ]
$show_informational setCurrentValue [ boolean [ $messager isInformationalEnabled ] ]
$show_warning setCurrentValue [ boolean [ $messager isWarningEnabled ] ]
$beep_on_error setCurrentValue [ boolean [ $messager isBeepEnabled ] ]
$log_to_file setCurrentValue [ boolean [ $messager isLogToFileEnabled ] ]
$use_report_dialog setCurrentValue [ $messager isReportDialogUsed ]
$file_browser setCurrentValue [ $messager getLogFile ]
$buffer_size setCurrentValue [ $messager getBufferSize ]
set status ""
$MessageOptions interact
set status [ $MessageOptions getStatus ]
if { $status == "apply" } {
set debug [ $show_debug getCurrentValue ]
set informational [ $show_informational getCurrentValue ]
set warning [ $show_warning getCurrentValue ]
set beep [ $beep_on_error getCurrentValue ]
set report [ $use_report_dialog getCurrentValue ]
set buf_size [ $buffer_size getCurrentValue ]
set log_file [ $file_browser getCurrentValue ]
set log [ $log_to_file getCurrentValue ]
$messager setDebugEnabled $debug
$messager setInformationalEnabled $informational
$messager setWarningEnabled $warning
$messager setBeepEnabled  $beep
$messager setReportDialogUsed $report
$messager setBufferSize $buf_size
$messager setLogToFileEnabled $log
$messager setLogFile $log_file
GuidoExecServer "UpdateMessageOptions" [subst { SetBeep = $beep SetBufferSize = $buf_size SetLogFile = "$log_file" SetLog = $log SetDebug = $debug SetInformational = $informational SetWarning = $warning} ]
}
$MessageOptions destroy
