Jump to content
Sign in to follow this  
xjoker_

Problem with Dialogs

Recommended Posts

Hello.

 

I have 2 dialogs, let's call them D1 and D2.

 

I use createDialog "D1" to open D1.

 

On D1, i have a RscPicture with a text="menu\img1.paa"

But I use onLoad = "[] spawn myFunction"; to set a new picture in a specific case

myFunction : if(condition) then { ((findDisplay 6900) displayCtrl 6901) ctrlSetText "menu\img2.paa";};

It works great.

 

Now while on D1, i press a button, which close D1 (closeDialog 0), and open D2 (createDialog "D2")

on D2, I press a button which close D2 (closeDialog 0), and reopen D1 (createDialog "D1").

 

Problem : the onLoad event is still called, good , the condition is true (i displayed a hint to be sure), BUT, this time, the picture doesn't change.

So 

((findDisplay 6900) displayCtrl 6901) ctrlSetText "menu\img2.paa";

has no effect the second time.

 

Could you please explain me why ? 

Share this post


Link to post
Share on other sites

I can't believe that no one encoutered this problem before :(

How do you do to navigate between between several displays ? I could probably use a lot of ctrlShow false and create only 1 dialog but i don't think it's the best solution if i have many controls...

Share this post


Link to post
Share on other sites

Did you check that the control is found correctly? I suspect the findDisplay may be failing to find the display. It's best to use the display reference contained in onLoad's _this.

  • Like 1

Share this post


Link to post
Share on other sites

I'm fairly new to dialogs aswell.

Did you check that both idd and idc are properly set?

Also note that the idc only exists locally to the display, if I'm correct.

 

Cheers

Share this post


Link to post
Share on other sites

Did you check that the control is found correctly? I suspect the findDisplay may be failing to find the display. It's best to use the display reference contained in onLoad's _this.

 

It works ! Thank you !

Solution : 

Do not use findDisplay in this case

use 

onLoad = "[_this select 0] spawn myFunction";

and in myFunction simply use 

params ["_display"];
(_display displayCtrl 6901) ctrlSetText ...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×