From 748e1bd3de04364ca5fdf65c744e519dcbdf324e Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Fri, 28 Apr 2000 14:41:04 +0000 Subject: [PATCH] Added method to select textfield. Fixed error in pixel/percent menulist initialization --- editor/ui/composer/content/EditorContent.css | 9 --------- editor/ui/dialogs/content/EdDialogCommon.js | 19 +++++++++++++++---- editor/ui/dialogs/content/EdHLineProps.js | 3 ++- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/editor/ui/composer/content/EditorContent.css b/editor/ui/composer/content/EditorContent.css index 2d7e7e6cbbc4..8503c9b1d4d2 100644 --- a/editor/ui/composer/content/EditorContent.css +++ b/editor/ui/composer/content/EditorContent.css @@ -29,15 +29,6 @@ a[name]:before { content: url(chrome://editor/skin/images/anchor-in-doc.gif); - /* display: inline; */ - -/* margin-left: 2px; */ - - /* - padding-left: 13px; - background: url(chrome://editor/skin/images/anchor-in-doc.gif) no-repeat; - background-position: center left; -*/ } /* Force border display for empty cells diff --git a/editor/ui/dialogs/content/EdDialogCommon.js b/editor/ui/dialogs/content/EdDialogCommon.js index 53be736ddb27..1f97bd2c7dc6 100644 --- a/editor/ui/dialogs/content/EdDialogCommon.js +++ b/editor/ui/dialogs/content/EdDialogCommon.js @@ -139,6 +139,17 @@ function ValidateNumberString(value, minValue, maxValue) // Return an empty string to indicate error return ""; } +function SetTextfieldFocus(textfield) +{ + if (textfield) + { + textfield.focus(); + //TODO: This is not working -- did Simon checkin? Do we need to change XBL? + textfield.selectionStart = 0; + //TODO: Simon should change this to support "-1" for "select to end" + textfield.selectionEnd = textfield.value.length; + } +} function ShowInputErrorMessage(message) { @@ -301,11 +312,11 @@ function InitPixelOrPercentMenulist(elementForAtt, elementInDoc, attribute, menu { // Strip out the % size = size.substr(0, percentIndex); - if (pixelItem) - menulist.selectedItem = pixelItem; + if (percentItem) + menulist.selectedItem = percentItem; } - else if(percentItem) - menulist.selectedItem = percentItem; + else if(pixelItem) + menulist.selectedItem = pixelItem; return size; } diff --git a/editor/ui/dialogs/content/EdHLineProps.js b/editor/ui/dialogs/content/EdHLineProps.js index e943de141c46..09f7d0003ccd 100644 --- a/editor/ui/dialogs/content/EdHLineProps.js +++ b/editor/ui/dialogs/content/EdHLineProps.js @@ -164,6 +164,7 @@ function ValidateData() if (height == "") { // Set focus to the offending control dump("Height is empty\n"); + SetTextfieldFocus(dialog.heightInput); dialog.heightInput.focus(); return false; } @@ -188,7 +189,7 @@ function ValidateData() if (isPercent) width = width + "%"; - dump("Height="+height+" Width="+width+"\n"); +dump("HLine: Height="+height+" Width="+width+"\n"); globalElement.setAttribute("width", width); align = "left";