Ingo Chou Posted January 12, 2016 Share Posted January 12, 2016 Hello, CASTORGUI::GUICheckbox.setChecked(true) does not work. It seems like "checked" is undefined in function: CASTORGUI::GUICheckbox.setChecked() Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 12, 2016 Share Posted January 12, 2016 It works well for me. I send a change of this function, but it should not change anything to your problem. Show your code that uses the group of checkox, you may have made a mistake somewhere. make sure you have any unique id too. Quote Link to comment Share on other sites More sharing options...
Ingo Chou Posted January 13, 2016 Author Share Posted January 13, 2016 Hello, Thanks for your reply. My checkbox is added in a panel and it's ID is unique. It works if do not added in panel or dialog. var mydlg = new CASTORGUI.GUIWindow("mydlg", {x:10, y: 50, w:400: h:500}, guisystem); mydlg.setVisible(true); var pnl = new CASTORGUI.GUIPanel("pnlUi", {x:0, y:0, w:300, h:300}, guisystem, null, false); pnl.setVisible(true); mydlg.add(pnl); var fun = function (e) { alert('click') } var checkbox = new CASTORGUI.GUICheckbox("checkboxHideMesh", { x:5, y:10, size:1.2 }, guisystem, fun, false); //checkbox.setChecked(true); pnl.add(checkbox); Thanks for your help. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 13, 2016 Share Posted January 13, 2016 Ok I see. this is because when you use setChecked, it does not yet exist in your panel, because you add after that. var fun = function (e) { alert('click') } var checkbox = new CASTORGUI.GUICheckbox("checkboxHideMesh", { x:5, y:10, size:1.2 }, guisystem, fun, false); pnl.add(checkbox); // checkox add panel checkbox.setChecked(true); // and checkbox exist. you can use setCkecked. Quote Link to comment Share on other sites More sharing options...
Ingo Chou Posted January 14, 2016 Author Share Posted January 14, 2016 OK, it works well now. Thanks for your timely reply and 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.