Using control prevents behavior from working

This forum is currently in read-only mode.
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hi everyone,

    First thanks for this awesome tool that is Construct. I am very much impressed by how easy it is to use

    I'm building some simple samples in order to get myself familiar with Construct. It was a flawless experience until I added buttons on the layout. It seems that once a control has focus, behaviors stop getting input user events (keyboard strokes).

    Here is a simple way to reproduce this problem:

    * create Sprite

    * add Grid Movement behavior to Sprite

    * create Button

    Run game. The sprite moves as expected until the button is clicked. I found some older thread that discuss a similar problem, but no work around is discussed.

    http://www.scirra.com/forum/viewtopic.php?f=3&t=4719

    http://www.scirra.com/forum/viewtopic.php?f=3&t=2367

    It seems to me that the simplest solution would be to be able to get the focus back on the layout so the behavior would get the input user events. But I couldn't find how to do this in Construct.

    Thanks to anyone that can help me!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Focus can be returned to the layout with the winapi through some python. All you need is to add the Window object to your cap and use this python script:

    from ctypes import *
    windll.user32.SetFocus(Window.AppWindow)[/code:2hmaemm3]
  • Thanks a lot, that worked!

    I didn't realized that there was a Window object until you pointed it out, and so now I've tried a few things and I found that calling "Show window" also does the trick without the need to have a python script.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)