The current idea is like:
Code: Select all
<xml>
<window style="fullscreen" bgcolor="#0010B7" transparency="179"
onclick="if (!isLogin) { exit(); } else { child.hide(); }"
classname="SSABackground" onSysKeyPress="
if (key == SYS_KEY_HOME) {
child.show();
} else {
if (!isLogin) {
exit();
}
}
">
<bool name="isLogin" value="false" />
<module type="SYS_MOD_PASSWORD" />
<window classname="SSAWindow" name="child" style="static">
<label caption="Username:" x="8" y="8" width="104" height="16" />
<textbox x="112" y="8" width="104" height="16" name="Username"/>
<label caption="Password:" x="8" y="32" width="104" height="16" />
<textbox x="112" y="32" width="104" height="16" name="Password" />
<button caption="Login" x="72" y="56" width="72" height="24" onClick="
passmodule.switch(parent.Username.text, parent.Password.text);
// if it gets here, it didn't switch, so one of two is wrong
MessageBox(\"Username or password incorrect.\", \"Error logging in\");
" />
</window>
<label location="centered" caption="Press ctrl-alt-home to login" />
</window>
</xml>
Code: Select all
<xml>
<window classname="SSAWindow" style="static">
<label caption="Username:" x="8" y="8" width="104" height="16" />
<textbox x="112" y="8" width="104" height="16" name="Username"/>
<label caption="Password:" x="8" y="32" width="104" height="16" />
<textbox x="112" y="32" width="104" height="16" name="Password" />
<button caption="Login" x="72" y="56" width="72" height="24" name="LoginButton" />
</window>
<window style="fullscreen" bgcolor="#0010B7" transparency="179"
classname="SSABackground">
<window classname="SSAWindow" name="child" />
<bool name="isLogin" value="false" />
<module type="SYS_MOD_PASSWORD" />
<label location="centered" caption="Press ctrl-alt-home to login" />
</window>
</xml>
-- snip, file something.code starts
SSABackground::onSysKeyPress () {
if (key == SYS_KEY_HOME) {
child.show();
} else {
if (!isLogin) {
exit();
}
}
}
SSAWindow::onClick() {
if (!isLogin) {
exit();
} else {
child.hide();
}
}
SSAWindow::LoginButton::onClick() {
passmodule.switch(parent.Username.text, parent.Password.text);
// if it gets here, it didn't switch, so one of two is wrong
MessageBox(\"Username or password incorrect.\", \"Error logging in\");
}
Anyone have an idea similar to this, or an improvement? I'm thinking most about the second one, but it has an obvious difficulty with children and functions.