Added method to select textfield. Fixed error in pixel/percent menulist initialization

This commit is contained in:
cmanske%netscape.com 2000-04-28 14:41:04 +00:00
parent 5478643ae1
commit 748e1bd3de
3 changed files with 17 additions and 14 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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";