Aug 17, 2010, 9:14 PM
[CLOSED] ComboBox and MultiCombo resizing when cycling read-only state
I have a form that can open in either read-only or edit mode. The absolute layout is used, as are FieldLabels with custom LabelWidths. The sizes of both the ComboBoxes and the MultiCombos are reduced whenever their read-only state is changed by setReadOnly.
In the example below, the expected layout can be seen by clicking 'Show Edit' first. However, closing the window and re-opening it with 'Show ReadOnly' results in the fields shrinking. Switching back to 'Show Edit' shrinks them further. Closing and reopening with the same button does not cause a change in size.
In the example below, the expected layout can be seen by clicking 'Show Edit' first. However, closing the window and re-opening it with 'Show ReadOnly' results in the fields shrinking. Switching back to 'Show Edit' shrinks them further. Closing and reopening with the same button does not cause a change in size.
<%@ Page Language="C#" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test Field Width</title>
<ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" />
<script type="text/javascript">
var MyApp = {
showWindow: function (readOnly) {
readOnly = !!readOnly;
ComboBox1.setReadOnly(readOnly);
ComboBox2.setReadOnly(readOnly);
MultiCombo1.setReadOnly(readOnly);
NumberField1.setReadOnly(readOnly);
MultiCombo2.setReadOnly(readOnly);
TestWindow.show();
}
};
</script>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Window runat="server" ID="TestWindow"
Width="500"
Height="400"
Padding="10"
Resizable="false"
Hidden="true"
CloseAction="Hide"
Modal="true"
Layout="Fit">
<Items>
<ext:FormPanel runat="server" ID="TestForm"
BaseCls="x-plain"
Layout="Absolute">
<Items>
<ext:ComboBox runat="server" ID="ComboBox1"
FieldLabel="Combo 1"
LabelWidth="140"
X="0"
Y="5"
Anchor="100%" />
<ext:ComboBox runat="server" ID="ComboBox2"
FieldLabel="Combo 2"
LabelWidth="140"
X="0"
Y="35"
Anchor="100%" />
<ext:MultiCombo runat="server" ID="MultiCombo1"
FieldLabel="MultiCombo 1"
LabelWidth="110"
X="30"
Y="65"
Anchor="100%" />
<ext:NumberField runat="server" ID="NumberField1"
FieldLabel="NumberField 1"
LabelWidth="110"
X="30"
Y="95"
Anchor="100%" />
<ext:MultiCombo runat="server" ID="MultiCombo2"
FieldLabel="MultiCombo 2"
LabelWidth="100"
X="40"
Y="125"
Anchor="100%" />
</Items>
</ext:FormPanel>
</Items>
</ext:Window>
<ext:Button runat="server" Text="Show Edit">
<Listeners>
<Click Handler="MyApp.showWindow();" />
</Listeners>
</ext:Button>
<ext:Button runat="server" Text="Show ReadOnly">
<Listeners>
<Click Handler="MyApp.showWindow(true);" />
</Listeners>
</ext:Button>
<form id="form1" runat="server"></form>
</body>
</html>
Last edited by Daniil; Aug 20, 2010 at 3:52 PM.
Reason: [CLOSED]