R34P3R 11 Posted March 13, 2015 hey guys. i cant get my ComboBox filled :-( Hope someone can help me because i cant find any error and also the game returns no error :-( Thanks a Lot. The Class: class RscCombo { access = 0; // Control access (0 - ReadAndWrite, 1 - ReadAndCreate, 2 - ReadOnly, 3 - ReadOnlyVerified) idc = CT_COMBO; // Control identification (without it, the control won't be displayed) type = CT_COMBO; // Type is 4 style = ST_LEFT + LB_TEXTURES; // Style default = 0; // Control selected by default (only one within a display can be used) blinkingPeriod = 0; // Time in which control will fade out and back in. Use 0 to disable the effect. x = 1 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X; // Horizontal coordinates y = 9 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y; // Vertical coordinates w = 10 * GUI_GRID_CENTER_W; // Width h = 1 * GUI_GRID_CENTER_H; // Height colorBackground[] = {0.2,0.2,0.2,1}; // Fill color colorSelectBackground[] = {1,0.5,0,1}; // Selected item fill color sizeEx = 0.03; // Text size font = PuristaMedium; // Font from CfgFontFamilies shadow = 0; // Shadow (0 - none, 1 - N/A, 2 - black outline) colorText[] = {1,1,1,1}; // Text and frame color colorDisabled[] = {1,1,1,0.5}; // Disabled text color colorSelect[] = {1,1,1,1}; // Text selection color pictureColor[] = {1,0.5,0,1}; // Picture color pictureColorSelect[] = {1,1,1,1}; // Selected picture color pictureColorDisabled[] = {1,1,1,0.5}; // Disabled picture color tooltip = "CT_COMBO"; // Tooltip text tooltipColorShade[] = {0,0,0,1}; // Tooltip background color tooltipColorText[] = {1,1,1,1}; // Tooltip text color tooltipColorBox[] = {1,1,1,1}; // Tooltip frame color arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_ca.paa"; // Expand arrow arrowFull = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_active_ca.paa"; // Collapse arrow wholeHeight = 5 * GUI_GRID_CENTER_H; // Maximum height of expanded box (including the control height) maxHistoryDelay = 1; // Time since last keyboard type search to reset it soundExpand[] = {"\A3\ui_f\data\sound\RscCombo\soundExpand",0.1,1}; // Sound played when the list is expanded soundCollapse[] = {"\A3\ui_f\data\sound\RscCombo\soundCollapse",0.1,1}; // Sound played when the list is collapsed soundSelect[] = {"\A3\ui_f\data\sound\RscCombo\soundSelect",0.1,1}; // Sound played when an item is selected class ComboScrollBar { width = 0; // width of ComboScrollBar height = 0; // height of ComboScrollBar scrollSpeed = 0.01; // scrollSpeed of ComboScrollBar arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; // Arrow arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; // Arrow when clicked on border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; // Slider background (stretched vertically) thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; // Dragging element (stretched vertically) color[] = {1,1,1,1}; // Scrollbar color }; }; The Dialog: class test_dialog { idd=33993; movingenable=false; class controls { class RscCombo_2100: RscCombo { idc = 2100; x = 0.225; y = 0.1; w = 0.35; h = 0.04; onLBSelChanged = "systemChat str ['onLBSelChanged',_this]; false"; }; }; }; The Call: r3_ShowDialog = { createDialog "test_dialog"; waitUntil {sleep 0.01; (!(isNull (findDisplay 33993)))}; {lbAdd[2100,_x]} forEach ["Combo 1","Combo 2","Combo 3"]; _index = lbAdd [2100, "TEST"]; }; No items will added to the Combo. Share this post Link to post Share on other sites
Senshi 10 Posted March 13, 2015 You are trying to lbadd to the IDCs, not the controls. Try: r3_ShowDialog = { createDialog "test_dialog"; waitUntil {sleep 0.01; (!(isNull (findDisplay 33993)))}; {lbAdd[findDisplay 33993 displayctrl 2100,_x]} forEach ["Combo 1","Combo 2","Combo 3"]; _index = lbAdd [findDisplay 33993 displayctrl 2100, "TEST"]; }; Share this post Link to post Share on other sites
dreadedentity 278 Posted March 13, 2015 You cannot use suspension(ie. waitUntil) in a call statement, use spawn instead. What's happening is that your function runs up until that waitUntil statement, then it exits with an error. Furthermore, even if it was okay to use waitUntil, it's not okay to use sleep and the function would exit at nearly the same place. I'm surprised you're not getting an error message for that Basically, your lbAdd commands never get run. EDIT: @Senshi the syntax is correct, I'm quite certain the use of suspension is the culprit Share this post Link to post Share on other sites
R34P3R 11 Posted March 13, 2015 I already spawning the function. Share this post Link to post Share on other sites
killzone_kid 1331 Posted March 13, 2015 You are trying to lbadd to the IDCs, not the controls.Try: r3_ShowDialog = { createDialog "test_dialog"; waitUntil {sleep 0.01; (!(isNull (findDisplay 33993)))}; {lbAdd[findDisplay 33993 displayctrl 2100,_x]} forEach ["Combo 1","Combo 2","Combo 3"]; _index = lbAdd [findDisplay 33993 displayctrl 2100, "TEST"]; }; Have you tried what you're suggesting? Because BIKI says 1st param is idc and not control Syntax:Number = lbAdd [idc, text] Parameters: [idc, text]: Array idc: Number of control ---------- Post added at 16:23 ---------- Previous post was at 16:09 ---------- Do you not get the errors about missing params when execute createDialog "test_dialog"; OP? Share this post Link to post Share on other sites
Senshi 10 Posted March 13, 2015 Actually, I always did the bulky findidsplay displayctrl way for all kinds of control interactions (setcolor/setpicture, etc.), and it works fine. It was just now that I realized I made it more difficult than necessary ;) . Apparently it works both ways. Share this post Link to post Share on other sites
R34P3R 11 Posted March 13, 2015 _index = lbAdd [findDisplay 33993 displayctrl 2100, "TEST"]; Ok i tryed it with the control but still no Items in the Combo :-( @KZ thats the problem.. i dont get any errors ! Also checked the rpt file. Share this post Link to post Share on other sites
dreadedentity 278 Posted March 13, 2015 put this code after all the lbAdd commands you have, then run it again: hint str (lbSize 2100); systemChat str (lbSize 2100); If it says 0, then they are indeed not being added to the combobox Share this post Link to post Share on other sites
R34P3R 11 Posted March 14, 2015 put this code after all the lbAdd commands you have, then run it again: hint str (lbSize 2100); systemChat str (lbSize 2100); If it says 0, then they are indeed not being added to the combobox Hmmmm the returned value is: 1 Share this post Link to post Share on other sites
R34P3R 11 Posted March 14, 2015 It work ! disableSerialization; and new class: class RscCombo { style = 16; type = 4; x = 0; y = 0; w = 0.12; h = 0.035; shadow = 0; colorSelect[] = {0.98,0.65,0,1}; colorText[] = {0.85,0.47,0,1}; colorBackground[] = {0.12,0.12,0.12,1}; colorSelectBackground[] = {0.24,0.24,0.24,0.6}; colorScrollBar[] = {1,0,0,1}; arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_ca.paa"; arrowFull = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_active_ca.paa"; wholeHeight = 0.45; color[] = {1,1,1,1}; colorActive[] = {1,0,0,1}; colorDisabled[] = {1,1,1,0.25}; font = "PuristaMedium"; sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.7)"; class ComboScrollBar { color[] = {1,1,1,0.6}; colorActive[] = {1,1,1,1}; colorDisabled[] = {1,1,1,0.3}; thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; }; soundSelect[] = { "", 0, 1 }; soundExpand[] = { "", 0, 1 }; soundCollapse[] = { "", 0, 1 }; maxHistoryDelay = 0; }; Share this post Link to post Share on other sites