Simon_JuYt 1 Posted March 8, 2023 Hi, im trying to make a list, i create the dialog, and its all okey, but when i try to select anything from the list, i make a hint reporting the index and the text, and the index in all the cases is -1, is like when i select an menu option, and it doesent select, any idea, for why it happends. Here is the code: createDialog "cuerposDiag"; _display = findDisplay 7726; _lista = _display displayCtrl 5245; _boton = _display displayCtrl 1600; _arrayCuerpos = [ "Cuerpo1", "Cuerpo2", "Cuerpo3", "Cuerpo4", "Cuerpo5" ]; lbClear _lista; //Limpio la lista. _indexArray = 0; while {_indexArray < (count _arrayCuerpos)} do { _lista lbAdd (_arrayCuerpos select _indexArray); _lista lbSetData [_indexArray, (_arrayCuerpos select _indexArray)]; _indexArray = _indexArray + 1; }; index = lbCurSel _lista; getLbText = _lista lbText index; life_fnc_boton = { if (index == -1) exitWith { hint "No has seleccionado ninguna opción"; }; hint format ["%1 | %2", getLbText, index]; }; _boton buttonSetAction '[] call life_fnc_boton;'; Share this post Link to post Share on other sites
soldierXXXX 113 Posted March 8, 2023 Hi. Replace this part of code with this and it should work (not tested). Do you need explanation ? //index = lbCurSel _lista; //getLbText = _lista lbText index; life_fnc_boton = { _display = findDisplay 7726; _lista = _display displayCtrl 5245; _index = lbCurSel _lista; _getLbText = _lista lbText _index; if (_index == -1) exitWith { hint "No has seleccionado ninguna opción"; }; hint format ["%1 | %2", _getLbText, _index]; }; 2 Share this post Link to post Share on other sites
Simon_JuYt 1 Posted March 8, 2023 28 minutes ago, soldierXXXX said: Hi. Replace this part of code with this and it should work (not tested). Do you need explanation ? //index = lbCurSel _lista; //getLbText = _lista lbText index; life_fnc_boton = { _display = findDisplay 7726; _lista = _display displayCtrl 5245; _index = lbCurSel _lista; _getLbText = _lista lbText _index; if (_index == -1) exitWith { hint "No has seleccionado ninguna opción"; }; hint format ["%1 | %2", _getLbText, _index]; }; It works, thanks mate! I've trying it some days and you give me the answer, thanks! 1 Share this post Link to post Share on other sites