User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Creating a button dynamically (C++)

02 Sep 2014, 19:27

Hi Michael,

Is the problem present if you take the official LeadWerks wrappers and change the default by the one you are using?

I am looking for an easy way to debug this here because we are not able to reproduce it.
 
Michael_J
Topic Author
Posts: 20
Joined: 02 Apr 2014, 14:22

Re: Creating a button dynamically (C++)

03 Sep 2014, 00:23

Hi,

I JUST found the problem: since there are multiple pages on an MFD (navigation, weapons, etc, etc), each update I would hide all the page sub-canvases at the beginning of my MFD update method, and then un-hide the proper one a bit further down in a switch/case. While this allowed the page to render, it did NOT allow it to update (even if I set the enabled property to true).

I changed this so that, in each case, I would show what was needed and hide the others. This allows the shown page to update properly--I guess because I'm not toggling the visibility flag from off to on each frame?

In any case, it now works. That said (without knowing the underlying framework obviously), I would think toggling visible from off to on in one frame should not cause this behavior. However, now that I know how to handle it it's a non-issue on this end :)

Thanks for the help...
 
User avatar
jsantos
Site Admin
Posts: 2906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Creating a button dynamically (C++)

05 Sep 2014, 01:53

Thanks for the information Michael! It seems that there is something wrong at our side. We are investigating it to be fixed in the next version.
 
User avatar
sfernandez
Site Admin
Posts: 1918
Joined: 22 Dec 2011, 19:20

Re: Creating a button dynamically (C++)

30 Sep 2014, 18:28

Hi,

I JUST found the problem: since there are multiple pages on an MFD (navigation, weapons, etc, etc), each update I would hide all the page sub-canvases at the beginning of my MFD update method, and then un-hide the proper one a bit further down in a switch/case. While this allowed the page to render, it did NOT allow it to update (even if I set the enabled property to true).

I changed this so that, in each case, I would show what was needed and hide the others. This allows the shown page to update properly--I guess because I'm not toggling the visibility flag from off to on each frame?

In any case, it now works. That said (without knowing the underlying framework obviously), I would think toggling visible from off to on in one frame should not cause this behavior. However, now that I know how to handle it it's a non-issue on this end :)

Thanks for the help...
What do you mean for each Update? Every frame? Or only on response to a button click?

What are you exactly doing with the sub-canvases? First SetVisibility(Visibility_Hidden) for all of them, then SetVisibility(Visibility_Visible) for the one visible canvas?

I was trying to reproduce the error without luck :(
 
Michael_J
Topic Author
Posts: 20
Joined: 02 Apr 2014, 14:22

Re: Creating a button dynamically (C++)

30 Sep 2014, 19:07

Yes, I WAS setting all sub-canvases to SetVisibility(Visibility_Hidden) , and then SetVisibility(Visibility_Visible) for the valid sub-canvas representing the selected MFD mode. Yes, I was doing this each frame. It obviously wasn't the most optimized method but I don't code for optimization on my "brainstorming" pass :)

Anyway, it was setting a sub-canvas to invisible and then visible each frame that was causing the problem. Once I changed this so that they only change when a different mode was selected (hence not each frame) everything worked fine...

I'm not too concerned about this really now that I know what causes it. Still seems like abnormal behavior, so thanks for taking a look :)
 
User avatar
sfernandez
Site Admin
Posts: 1918
Joined: 22 Dec 2011, 19:20

Re: Creating a button dynamically (C++)

01 Oct 2014, 17:30

I finally understood what was happening. Button mouse capture was instantly released when setting the visibility of the container to hidden. This causes that the Button.IsPressed property was set to false, so MouseUp event was not raising the corresponding Click event.

This problem will be fixed for the next version.
 
Michael_J
Topic Author
Posts: 20
Joined: 02 Apr 2014, 14:22

Re: Creating a button dynamically (C++)

01 Oct 2014, 17:43

Excellent. Thanks for sticking with it :)

Who is online

Users browsing this forum: No registered users and 2 guests