Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: noelbruton on January 02, 2008, 12:02:10 PM
-
Am I doing something stupid? I have a window with an editor and two buttons. I can enter text in the editor and I can see the cursors over the buttons but the buttons do not respond, window will not close, ESC doesn't work and I have to CTRL-ALT-DEL to get out of the scene.
The game calls the window:
var MyWindow = Game.LoadWindow("scenes\Computer\scr\password.window");
MyWindow.Center();
MyWindow.GoExclusive();
The window says:
WINDOW
{
X = 0
Y = 0
WIDTH = 1024
HEIGHT = 768
NAME = "PasswordWindow"
IMAGE = "scenes\17_Rhiannon\Computer\PasswordScreen.png"
SCRIPT = "scenes\17_Rhiannon\Computer\scr\password.script"
EDIT
{
NAME = "pwentry"
; position and size (relative to the window position)
X = 383
Y = 370
WIDTH = 250
HEIGHT = 42
; editor state
VISIBLE = TRUE
DISABLED = FALSE
; fonts
FONT = "fonts\sserif.font"
FONT_SELECTED = "fonts\outline_red.font"
; extended properties
PARENT_NOTIFY = TRUE
MAX_LENGTH = 8
FRAME_WIDTH = 2
}
BUTTON
{
NAME = "ok"
X = 578
Y = 426
WIDTH = 60
HEIGHT = 36
CURSOR = "sprites\system\RhiannonCursors\Action2.png"
}
BUTTON
{
NAME = "power_down"
X = 512
Y = 692
WIDTH = 40
HEIGHT = 50
CURSOR = "sprites\system\RhiannonCursors\Action2.png"
}
}
The Window script says:
#include "scripts\base.inc"
#include "scripts\keys.inc"
var Editor;
Editor = this.GetControl("pwentry");
////////////////////////////////////////////////////////////////////////////////
on "ok"
{
// Check whether it's the right password
this.Close();
}
on "power_down"
{
this.Close();
}
////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
var button;
if(Keyboard.KeyCode==VK_ESCAPE)
{
button = self.GetControl("close");
button.Press();
}
else if(Keyboard.KeyCode==VK_RETURN)
{
button = self.GetControl("ok");
button.Press();
}
}
I've read everything I can find on the forum and now I'm completely at a loss. Can anybody help please?
Thanks
NB
-
You will need to add the following line to the buttons definitions:
PARENT_NOTIFY = TRUE
Currently your buttons don't send any events to the window, that's why you can't do anything with it.
Any reason why you're not using the WindowEdit editor?
-
Thanks Mnemonic, that fixed it. I've never really fully understood what a 'Parent' is until now. As to not using the Window editor - I just got used to doing windows manually before you released the editor, but this is the first time I've needed a window that can accept keyboard input.
Thanks again and Happy New Year.
NB