BomosBoy 13 Posted April 6, 2017 If you call a function with onLoad in the dialog display you cant use lbSetCurSel. I discovered this today and iam not sure if its a bug or if i missed something. Example: /* Dialog */ class ExampleDialog { onLoad = "[] call SUPERTAG_fnc_SUPERFUNC"; //... class ComboBox : RscCombo { idc = 5000; x = 0.35 * safezoneW + safezoneX; y = 0.849 * safezoneH + safezoneY; w = 0.3 * safezoneW; h = 0.02 * safezoneH; onLBSelChanged = "[] call SUPERCOMBO_fnc_COMBO"; }; }; /* Function SUPERTAG_fnc_SUPERFUNC */ //Adding elements to ComboBox //... (_display displayCtrl 5000) lbSetCurSel 0; /* Function SUPERCOMBO_fnc_COMBO */ //... _index = lbCurSel 5000; //INDEX ALWAYS RETURNS -1 My Problem is that i fill the combobox with elements with the onLoad function. Normaly if you use lbSetCurSel it automaticly fires a onLBSelChanged event. But this time lbCurSel always returns -1. So i cant set the cursor selection with lbSetCurSel in onLoad. Maby someone can help me. Share this post Link to post Share on other sites
MrCopyright 107 Posted April 6, 2017 Where is _display defined in your script? If I were you, I would use the primary syntax for the lbSetCurSel command. lbSetCurSel [5000, 0]; It does not require you to define the display; you only need to state the IDC of the listbox. Share this post Link to post Share on other sites
BomosBoy 13 Posted April 6, 2017 _display is just a variable for the _this select 0 in the display onLoad function. So the full "function" looks like onLoad = "[_this select 0] call SUPERTAG_fnc_SUPERFUNC"; //SUPERTAG_fnc_SUPERFUNC disableSerialization; _display = _this select 0; Share this post Link to post Share on other sites
BomosBoy 13 Posted April 6, 2017 FIXED: lbCurSel (_display displayCtrl 5000); Works now. _index = lbCurSel 101; Does not work (for me). So use Example 2 in the wiki if you have the same problem. Share this post Link to post Share on other sites