/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ ///////////////////////////////////////////////////////////////////////////////// // // Validator // ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // Create a row in the validator list box global proc LumberyardValidatorCreateRow(int $messageType, int $enableFocus, string $messageText) { setParent LUMBERYARDTOOL_VALIDATOR_LISTBOX; rowLayout -numberOfColumns 2 -columnWidth2 240 15 -rowAttach 2 "bottom" 0; { string $text = `text -wordWrap true -backgroundColor .95 .85 .65 -width 240 -align "left" -label $messageText`; string $button = `button -label "<>" -width 15 -backgroundColor 0.5 0.5 0.5 -command ("print \"Focus works!\"")`; // warning type if ($messageType == 0) { text -edit -backgroundColor .95 .85 .65 $text; } // error type else { text -edit -backgroundColor .95 .65 .65 $text; } if ($enableFocus) { button -edit -enable true $button; } else { button -edit -enable false $button; } } } ///////////////////////////////////////////////////////////////////////////////// // Run the validator to get problem messages global proc LumberyardValidatorValidate() { string $childItems[] = `scrollLayout -query -childArray LUMBERYARDTOOL_VALIDATOR_LISTBOX`; for ($child in $childItems) { deleteUI $child; } // give example messages LumberyardValidatorCreateRow 0 0 "This is a warning example. This is a warning example. This is a warning example. This is a warning example."; LumberyardValidatorCreateRow 1 1 "This is an error example. This is an error example. This is an error example. This is an error example."; } ///////////////////////////////////////////////////////////////////////////////// // Create validator frame global proc LumberyardToolCreateValidatorFrame() { setParent LUMBERYARDTOOL_MAIN_LAYOUT; frameLayout -collapsable false -borderStyle "etchedOut" -marginHeight 5 -marginWidth 5 -label "Validator" LUMBERYARDTOOL_VALIDATOR_FRAME; { columnLayout -adjustableColumn true LUMBERYARDTOOL_VALIDATOR_LAYOUT; { scrollLayout -height 120 -backgroundColor 0 0 0 -visible true LUMBERYARDTOOL_VALIDATOR_LISTBOX; } setParent LUMBERYARDTOOL_VALIDATOR_FRAME; button -label "Validate" -command ("LumberyardValidatorValidate") LUMBERYARDTOOL_VALIDATE_BUTTON; } }