Using control prevents behavior from working

For questions about using Classic.

Post » Wed Dec 22, 2010 4:43 pm

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.
[url:2dh9bgtd]http://www.scirra.com/forum/viewtopic.php?f=3&t=4719[/url:2dh9bgtd]
[url:2dh9bgtd]http://www.scirra.com/forum/viewtopic.php?f=3&t=2367[/url:2dh9bgtd]
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!
B
1
G
2
Posts: 2
Reputation: 629

Post » Wed Dec 22, 2010 7:18 pm

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:
[code:2hmaemm3]from ctypes import *
windll.user32.SetFocus(Window.AppWindow)[/code:2hmaemm3]
B
79
S
24
G
53
Posts: 4,731
Reputation: 40,225

Post » Wed Dec 22, 2010 10:06 pm

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.
B
1
G
2
Posts: 2
Reputation: 629


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 9 guests