Jump to content
Sign in to follow this  
lonesoldier

Dialog boxes

Recommended Posts

Ive been fiddling around with Dialog Boxes lately, and ive got a question, that i REALLY need an answer for.

My mission has 3 Recon Photo's, that are displayed in-mission via cutRsc.

Now, i want to display them via Dialog Box buttons.

The dialog box contains a dropdown ComboBox thing, with the Recon Photo's listed. You can then click on say... "Recon Photo 2", and then click "Display Photo", and it exec's a script.

This is whats in the script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_ok = createDialog "DlgTutorial"

?(!_ok): hint "Fehler!"; exit

_index = lbAdd [104, "Recon Photo's"]

lbSetData [104, _index, "Recon Photo's"]

_index = lbAdd [104, "Recon Photo 1"]

lbSetData [104, _index, "Recon Photo 1"]

_index = lbAdd [104, "Recon Photo 2"]

lbSetData [104, _index, "Recon Photo 2"]

_index = lbAdd [104, "Recon Photo 3"]

lbSetData [104, _index, "Recon Photo 3"]

_index = lbAdd [104, "Clear Screen"]

lbSetData [104, _index, "Screen Clear"]

lbSetCurSel [104, 0]

Where it has lbSetData [104, _index, "Recon Photo 1"] id like it to exec a script, instead of "Recon Photo 1".

How can i get it to exec a script, instead of display text???

Thats all i need to know.

One more quick question:

For the Dialog Box Slider, how can i make it exec a script for every time the slider is moved?

Say i move the slider up one level, how can i make it exec a script? Then i move it up another level, how can i make it exec a different script?

Share this post


Link to post
Share on other sites

There are several methods.

I use a loop in the script where start the dialog.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_ok = createDialog "DlgTutorial"

?(!_ok): hint "Fehler!"; exit

_index = lbAdd [104, "Recon Photo's"]

lbSetData [104, _index, "Recon Photo's"]

_index = lbAdd [104, "Recon Photo 1"]

lbSetData [104, _index, "Recon Photo 1"]

_index = lbAdd [104, "Recon Photo 2"]

lbSetData [104, _index, "Recon Photo 2"]

_index = lbAdd [104, "Recon Photo 3"]

lbSetData [104, _index, "Recon Photo 3"]

_index = lbAdd [104, "Clear Screen"]

lbSetData [104, _index, "Screen Clear"]

lbSetCurSel [104, 0]

_currentIndex = lbCursel 104

#Loop

     If  ((_currendIndex != lbCursel 104) && (lbCursel 104!= -1) )  then { _currentIndex = lbCursel 104; call format [ { [] exec {Script%1.sqs}},lbcursel 104] }

~0.01

if (ctrlvisible 104) then {goto "loop"}

Test for -1 : when you close a dialog values are updated before in the dialog, so lcursel 104 returns -1

For slider you use the same method with the sliderposition (if old position != sliderposition 100 then ....

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  

×