Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Using Editor - Window won't close  (Read 3543 times)

0 Members and 1 Guest are viewing this topic.

noelbruton

  • Arberth Studios
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 5
  • 'Rhiannon: Curse of the Four Branches' coming Aut
    • View Profile
    • Rhiannon: Beyond the Mabinogion
Using Editor - Window won't close
« 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
Logged
"Fans of popular horror adventures like 'Scratches' and 'Barrow Hill' should start bracing themselves for another haunting experience as independent developer has announced production on its debut title 'Rhiannon: Curse of the Four Branches;." - AdventureGamers.com

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Using Editor - Window won't close
« Reply #1 on: January 02, 2008, 01:15:51 PM »

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?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

noelbruton

  • Arberth Studios
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 5
  • 'Rhiannon: Curse of the Four Branches' coming Aut
    • View Profile
    • Rhiannon: Beyond the Mabinogion
Re: Using Editor - Window won't close
« Reply #2 on: January 02, 2008, 01:28:46 PM »

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
Logged
"Fans of popular horror adventures like 'Scratches' and 'Barrow Hill' should start bracing themselves for another haunting experience as independent developer has announced production on its debut title 'Rhiannon: Curse of the Four Branches;." - AdventureGamers.com
 

Page created in 0.041 seconds with 20 queries.