[Solved] cannot set property of undefined
-
wrote on 28 Mar 2014, 02:34 last edited by
@if (component.status == Component.Ready)
{
var game = component.createObject(main_Window, {});
game.focus = true;
}@@if (component.status == Component.Ready)
var game = component.createObject(main_Window, {});
game.focus = true;
@
If construction "IF" returned TRUE. I did as you say, ERROR disappeared but whatever didn't work, *It seems that IF returned false. * and component are not ready.
Why in QT all is ok, but from EXE i have this problem. -
wrote on 28 Mar 2014, 12:40 last edited by
well I'm sorry to tell you this but the code is not the same.
@
if (component.status == Component.Ready)
var game = component.createObject(main_Window, {});
game.focus = true;
@@
if (component.status == Component.Ready)
{
var game = component.createObject(main_Window, {});
}
game.focus = true;
@
that is why game.focus = true produces and warning because "game" is undefined at that line... seems like nobody else is reading this thread but you tr it yourself if you don't believe me -
wrote on 30 Mar 2014, 04:57 last edited by
well I’m sorry to tell you this but the code is the SAME, when IF returned TRUE. Anyway,I tried to do and it does NOT WORK, because var component = Qt.createComponent("Game.qml"); - not created, but in QT all ok, from EXE doesn't work.
-
wrote on 30 Mar 2014, 08:31 last edited by
Hi petro2033,
Welcome to Devnet.
I suggest you experiment with if blocks and braces and debug in every possible place to see what your variables contain as values.
@
If (A)
B;
C;
@Is not the same as
@
If (A)
{ B;
C;
}
@PS: using capitals is generally considered as shouting to people. Please avoid it on the forum. Xander is just willingly to help you
-
wrote on 30 Mar 2014, 12:16 last edited by
the same if A returned true....
Anyway thanks you, but anyway it doesn't work. -
wrote on 30 Mar 2014, 13:53 last edited by
[quote author="petro2033" date="1396181811"]the same if A returned true....
Anyway thanks you, but anyway it doesn't work.[/quote]But it's not the same if A doesn't return true, so in a whole it's not the same.
Anyway, how is var defined in your program?
-
wrote on 30 Mar 2014, 13:57 last edited by
hey of course it is the same if your "if" condition is evaluated to "true", but not if its "false".
in your case if the component is not ready there might be a problem in the pother QMl files (you didn't post it here so we can't help you with that):
@
var component = Qt.createComponent("Game.qml");
@
if that doesn't create a component either the QMl engine can't find the file or there is an error in the Game.qml, in any case you should see some error in the application console? -
wrote on 31 Mar 2014, 02:16 last edited by
ty all, but probles was that QtGraphicalEffects needs no dll, but needs QML file from Qt\Qt5.0.2\5.0.2\mingw47_32\qml\QtGraphicalEffects
-
wrote on 31 Mar 2014, 08:57 last edited by
[quote author="petro2033" date="1396232213"]ty all, but probles was that QtGraphicalEffects needs no dll, but needs QML file from Qt\Qt5.0.2\5.0.2\mingw47_32\qml\QtGraphicalEffects[/quote]
Does that mean that you figured out the problem? If so, please mark the thread as [Solved] by editing the title of you first post.)
14/14