Aug 27, 2012, 8:06 AM
Cursor not show after textField.focus()
Dear Sir,
After I changed version from 1.3 to 2.0. It seem command textField.focus() work not properly.
a cursor not show in TextField (after text in txtPassword) after command textField.focus()
code
Thank you
After I changed version from 1.3 to 2.0. It seem command textField.focus() work not properly.
a cursor not show in TextField (after text in txtPassword) after command textField.focus()
code
<%@ 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>Desktop - Ext.NET Examples</title>
<link rel="stylesheet" type="text/css" href="resources/css/examples.css" />
<script runat="server">
protected void btnLogin_Click(object sender, DirectEventArgs e)
{
string username = this.txtUsername.Text;
string password = this.txtPassword.Text;
if (username == password)
{
ExtNet.Msg.Show(new MessageBoxConfig
{
Title = "Warning",
Message = "Focus on txtUsername",
Buttons = MessageBox.Button.OK,
Icon = MessageBox.Icon.WARNING,
Closable = false,
Handler = @"switch (buttonId)
{
case 'ok' : txtPassword.focus(); break;
}"
});
}
else
{
ExtNet.Msg.Show(new MessageBoxConfig
{
Title = "Warning",
Message = "Focus on txtPassword",
Buttons = MessageBox.Button.OK,
Icon = MessageBox.Icon.WARNING,
Closable = false,
Handler = @"switch (buttonId)
{
case 'ok' : txtPassword.focus(); break;
}"
});
}
}
</script>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:KeyMap ID="KeyMap1" runat="server" Target="={Ext.isGecko ? Ext.getDoc() : Ext.getBody()}">
<ext:KeyBinding>
<Keys>
<ext:Key Code="BACKSPACE" />
</Keys>
<Listeners>
<Event Handler="var id = Ext.fly(e.getTarget()).getAttribute('id'),
t = Ext.getCmp(id),
v;
if (t instanceof Ext.TextField) {
e.preventDefault();
if (!t.readOnly) {
v = t.getValue();
if (v) {
t.setValue(v.substring(0, v.length - 1));
}
}
} else
{
e.preventDefault();
return true;
};" />
</Listeners>
</ext:KeyBinding>
</ext:KeyMap>
<h1>Log-in</h1>
<ext:Window
ID="Window1"
runat="server"
Closable="false"
Resizable="false"
Height="220"
Icon="Lock"
Title="Login"
Draggable="false"
Width="400"
Modal="true"
BodyPadding="40"
Layout="AnchorLayout">
<Items>
<ext:TextField
ID="txtUsername"
runat="server"
FieldLabel="Username"
AllowBlank="false"
BlankText="Your username is required."
LabelStyle="font-weight:600;text-align:right;"
AutoFocus="True"
AutoFocusDelay="100"
AnchorHorizontal="100%"
/>
<ext:TextField
ID="txtPassword"
runat="server"
InputType="Password"
FieldLabel="Password"
LabelStyle="font-weight:600;text-align:right;"
AllowBlank="false"
BlankText="Your password is required."
AnchorHorizontal="100%"
/>
</Items>
<Buttons>
<ext:Button ID="btnLogin" runat="server" Text="Login" Icon="Accept" Type="Submit">
<Listeners>
<Click Handler="
if (!#{txtUsername}.validate() || !#{txtPassword}.validate()) {
Ext.Msg.alert('Error','<font color=red>The Username and Password fields are both required</font>');
return false;
}
" />
</Listeners>
<DirectEvents>
<Click OnEvent="btnLogin_Click">
<EventMask ShowMask="true" Msg="Verifying..." MinDelay="500" />
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
</ext:Window>
</form>
</body>
</html>
please advice.Thank you
Last edited by Aod47; Aug 27, 2012 at 8:27 AM.