Jump to content
Sign in to follow this  
loki

saving the GUI color between dialogs

Recommended Posts

not sure how to explain this.. but

in the lost key i have several dialogs. i added the ability to switch GUI colors but when i close the GUI or switch to another.. the color resets to the default color.

how do i save the 'color' variable and call it for each of my dialogs?

in the mission init.sqf i have:

LOKI_GUI_Key_Color = 1;

and this is the script:

Color_Settings .sqf

disableSerialization;

switch (_this select 0) do

{

case "TextColor":

{

LOKI_GUI_Key_Color = LOKI_GUI_Key_Color + 1;

If (LOKI_GUI_Key_Color > 7) Then {LOKI_GUI_Key_Color = 1};

private ["_color"];

switch (LOKI_GUI_Key_Color) do

{

case 1:

{

_color = [1,0,0,1];

};

case 2:

{

_color = [0,1,0,1];

};

case 3:

{

_color = [1,0.5,0,1];

};

case 4:

{

_color = [0,1,1,1];

};

case 5:

{

_color = [1,1,1,1];

};

case 6:

{

_color = [1,1,0,1];

};

case 7:

{

_color = [0,0,1,1];

};

};

{

_control = (findDisplay 72000) displayCtrl _x;

_control ctrlSetTextColor _color;

_control ctrlCommit 0;

} forEach

[

// main GUI and Set Buttons

72100,72101,72102,72103,72104,72105,72106,72107,72108,72109,72110,72111,72112,72113,72114,

// Start Screen

72115,72116,72117,72118

];

};

};

if my question isn't clear enough.. let me know.

Edited by Loki
solved

Share this post


Link to post
Share on other sites

Hi (again) Loki. :)

You have to execute the Color Settings script each time you open the / a new dialog.

In the script where you call the dialog put something like this:

LOKI_GUI_Key_Color = LOKI_GUI_Key_Color - 1;
["TextColor"] execVM "Color_Settings.sqf";

Share this post


Link to post
Share on other sites

i had hoped you would see this.. it is yours after all.. :p

i got it to keep the color after 1st switch.. but its resetting after 2 switches and won't even work anymore.

rl has me busy today.. i will update when i get time to work at it some more.

i'll shoot you a PM when i update.

thanks Clayman

Edited by Loki
missed a sentence

Share this post


Link to post
Share on other sites

hmm.. this is really weird.

my main dialog is IDD = 72000

when i switch to another dialog.. say.. Work (IDD 72001) it works (color stays).. but when i go back to main dialog IDD 72000.. it won't switch the colors anymore..

does the IDD of a dialog somehow go NULL?

Share this post


Link to post
Share on other sites

solved.. thanks i0n0s... for showing that the dialogs wasn't closing fast enough.

a simple

waitUntil{!dialog};

was all i needed in each of my calls.

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  

×