Jump to content

Can I add panel into a dialog or window in CASTORGUI?


Ingo Chou
 Share

Recommended Posts

Sorry, I did not express myself clearly.

 

var mywindow = new CASTORGUI::GUIWindow( "window" ,{ x:0, y:0, w:500, h:300 }, gui )

 

var mypanel = new CASTORGI::GUIPanel(  "child" ,{ x:0, y:50, w:500, h:200 }, gui , false )

 

mywindow.add(mypanel)

 

mypanel.setVisible(true)

 

mywindow.setVisible(true)

 

 

The question is :

 

The panel "mypanel" can not be moved to new position when I  drag "mywindow" .

 

"mywindow" changed it position, but the "mypanel" NOT.

Link to comment
Share on other sites

I have send fix.  For your problem, it works after test. here's how I did.

var form = new CASTORGUI.GUIWindow("form", {x:(guisystem.getCanvasWidth().width / 2 - 100), y:200 , w:200, h:200}, guisystem);	// creat window			var optionsGUIText = { x: 10,y: 35, text: "- This window is draggable with panel.<br />", color: "white", size: 12 };// Options textvar textForWindow = new CASTORGUI.GUIText("textInfo", optionsGUIText, guisystem, false); //creat text												var panel = new CASTORGUI.GUIPanel("p", {w:200, h:200, backgroundColor:"red"}, guisystem); // creat panel redform.add(panel); // add panel in windowpanel.add(textForWindow); // add text in panel				panel.setVisible(true);form.setVisible(true);

I add a function to add GUIPanel if you want to add Elements

Link to comment
Share on other sites

Hi, Dave

 

Thanks for your help! Now I can add panel into window, and can move them together.

 

But there is a new problem, would you please fix it for me?

 

After adding a panel in window, now I add a GUITextures into my panel like this:

 

var img = new CASTORGUI::GUITextures("img","img/img.png",{x:0,y:0,w:64,h:64},gui, function(){alert("clicked")}, false);

 

mypanel.add(img);

 

But the image can not be displayed.

 

It can be displayed if use this:

 

​var img = new CASTORGUI::GUITextures("img","img/img.png",{x:0,y:0,w:64,h:64},gui, function(){alert("clicked")}, true);

 

And,  it is displayed not only in my panel, but also in the main window (web client).

 

And the callback does not work.

Link to comment
Share on other sites

Hi York,

 

I fixed two problem you mentioned.

 

This works now.

var img = new CASTORGUI::GUITextures("img","img/img.png",{w:64,h:64},gui, function(){alert("clicked")}, false);mypanel.add(img);mypanel.setVisible(true);

I also fixed any other element that had the same problem when they were added to another container.

 

CastorGUI is now in Version 1.3

Link to comment
Share on other sites

after testing it works well for me

var form = new CASTORGUI.GUIWindow("form", {x:(guisystem.getCanvasWidth().width / 2 - 100), y:200 , w:200, h:200}, guisystem);var checkbox = new CASTORGUI.GUICheckbox("check", { x: 10, y: 35}, guisystem, null, false);form.add(checkbox);form.setVisible(true);

Attention:

Error => CASTORGUI.GUICheckbox("check", { x: 10, y: 35}, guisystem, false);

Ok => CASTORGUI.GUICheckbox("check", { x: 10, y: 35}, guisystem, callback, false);

Link to comment
Share on other sites

Ok. thank you.

 

I made a mistake. I forgot to add the parameter "callback". 

 

In addition, there is an other problem relating to parameter "size" if I set size more than 1 :

 

It works well when use: CASTORGUI.GUICheckbox("check", { x: 10, y: 35, size:1 }, guisystem, callback, false);

 

But the checkbox will be displayed at wrong positon when use: CASTORGUI.GUICheckbox("check", { x: 10, y: 35, size:2 }, guisystem, callback, false);

 

I just want to scale the checkbox size around it's center.

 

thank you for your help.

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...