Hello folks, can anyone hre tell me, how to hide a SWT Control?
I tried setVisible( ), but the control is still using space in my composite and i want it completely disappear, like object.style.display = "none" in CSS.
Printable View
Hello folks, can anyone hre tell me, how to hide a SWT Control?
I tried setVisible( ), but the control is still using space in my composite and i want it completely disappear, like object.style.display = "none" in CSS.
Hide or destroy?
Just hiding might still use the container(need a place to hide too right?), just plain thinking.
I would suggest destroying it.
You could achieve what I suggest by looping over the the widgets in the container and then locating the one you want to destroy and then doing
controlObject.dispose();
Something like:
CheersCode:for(Control controlObject : nameOfContainer.getChildren()){
if(controlObject == nameOfYourControl){
controlObject.dispose();
}
}
-singswt
Ops, destroy the control is not a good solution, cause the user could desire sometime to it show up, turn it invisble is perfect, but as i said even invisible the control consumes space in the container.
And that's the problem, would be perfect to turn the control invisible and it completely vanish from the user's sign.
Why can't you new out the control when the user wants to see it? and fill up the properties of the control again, so basically having the code for the control in one place and using a method call to re populate the control could work.
Cause is simpler to just hide the control than destroy and build all the layout again to show it.
please do publish about how you succeeded when you succeed.
thanks,
Can any body how to open matlab with java swt
can any body know how to open matlab with activex controll in java swt?
can any body know how to open matlab with activex controll in java swt?
what you mean by open matlab ? can you explain?
You may try
.setVisible();
shell.layout();
If you're using GridLayout, you can use the exclude property on control's GridData.
Here's a link to an example snippet:
Exclude a widget from a GridLayout : Layout*«*SWT JFace Eclipse*«*Java