Ingo Chou Posted November 9, 2015 Share Posted November 9, 2015 Hi, I use CASTORGUI.GUISelect.addOptions() with this code: var sel = new CASTORGUI.GUISelect("testSel", { x: 5, y: 10, w: 200, h: 40 }, gui, { alert("click") }, false); for (var i = 0; i < 10; i++) { sel.addOptions("value", "text"); // ???? } mywin.add(sel); But it seems not work. However, it works without sel.addOptions("value", "text"); How can I use this GUI control method? Thanks for your help! Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 9, 2015 Share Posted November 9, 2015 You must add the elements after the Select Options element was added to the Window element.I also made a small correction This is how you do it:// Creat selectvar sel = new CASTORGUI.GUISelect("testSel", { x: 5, y: 25, w: 200, h: 20 }, guisystem, function() { alert("click")}, false); // Creat Windowvar form = new CASTORGUI.GUIWindow("form", {x:(guisystem.getCanvasWidth().width / 2 - 100), y:200 , w:200, h:200}, guisystem); // add element Select on Windowform.add(sel); // add options an element Selectfor (var i = 0; i < 10; i++) { sel.addOptions("value", "text");} // Window visibleform.setVisible(true); Quote Link to comment Share on other sites More sharing options...
Ingo Chou Posted November 11, 2015 Author Share Posted November 11, 2015 OK, thank you for your help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.