Jump to content

CASTORGUI::GUICheckbox.setChecked() does not work


Ingo Chou
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...