-FW- Shaanguy 10 Posted April 10, 2015 (edited) listbox, on click button any other way without using ( switch & case ), to find the item's script :D this is the code what i am using now :) switch (lbCurSel 1500) do { case 0: {hint "ITEM 1 = FILE";}; case 1: {hint "ITEM 2 = SOMETHING ELSE";}; default {hint "?";}; }; the problem here is, in a object's init, there is action = "Take File", when i take that file, it will be added to my listbox, but if I take a other item before "Take File" object, case 0 will be = ITEM 2 SOMETHING ELSE, and then if i use the action "Take File", case 1 will be the FILE :D, so i cant use case, is there a another method O_o ANY BROKEN WORD HERE? SORRY FOR THAT Solved = DID'NT WORK Edited April 10, 2015 by [FW] Shaanguy Found A Mistake Share this post Link to post Share on other sites
fight9 14 Posted April 10, 2015 (edited) Use lbSetData & lbData to give your list items a string value and then use that in your switch-case. That way it doesn't matter what index position they are in. _ctrl = _display displayCtrl 1500; // list items _index = _ctrl lbAdd "Item 1"; _ctrl lbSetData [_index,"item"]; _index = _ctrl lbAdd "Thing 2"; _ctrl lbSetData [_index,"thing"]; /////////////////////////////// /////////////////////////////// // get items _item = switch (_ctrl lbData (lbCurSel _ctrl)) do { case "item": {"Item 1"}; case "thing": {"thing 2"}; default {"Nothing"}; }; hint format ["I have %1"_item]; You could almost do the same thing using lbText. Return the displayed text from the index postion of the currently selected item. It all depends on what you are trying to do. Edited April 10, 2015 by Fight9 Share this post Link to post Share on other sites
-FW- Shaanguy 10 Posted April 10, 2015 (edited) um checking, wow i am playing ArmA series like 6 years!, still didn't knew these dialog scripts i guess. x) By Fight9 You could almost do the same thing using lbText. Return the displayed text from the index postion of the currently selected item. It all depends on what you are trying to do. that's right, well i am not good at dialog scripting. thank's for the more information in above fight9 THE NERD MODE Edited April 10, 2015 by [FW] Shaanguy Share this post Link to post Share on other sites