List Info

Thread: Remove control from Dlg with code ?




Remove control from Dlg with code ?
user name
2007-04-11 09:07:34
Hi,

I've a dialog, and add controls with the code.
Now I also want to remove control with the code.

What I've got is this:
   oDlgModel.removeByName("controlName")
   oContrl = oDocDlg.getControl("controlName")
   oDocDlg.removeControl(oContrl)

Result:
- control does not exist on the model
   (
oDocDlg.getModel.getByName("controlName").Text
    gives noSuchElementFound exception )
- but control is still visible.

So I miss how to remove the control from the view, or how to
refresh teh 
view.

Any suggestion?

Thanks,


-- 

Cor Nouws
Arnhem - Netherlands
nl.OpenOffice.org - marketing contact

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Remove control from Dlg with code ?
user name
2007-04-11 10:39:26
Cor Nouws wrote:
> Hi,
>
> I've a dialog, and add controls with the code.
> Now I also want to remove control with the code.
>
> What I've got is this:
>   oDlgModel.removeByName("controlName")
>   oContrl =
oDocDlg.getControl("controlName")
>   oDocDlg.removeControl(oContrl)
>
> Result:
> - control does not exist on the model
>   (
oDocDlg.getModel.getByName("controlName").Text
>    gives noSuchElementFound exception )
> - but control is still visible.
>
> So I miss how to remove the control from the view, or
how to refresh 
> teh view.
>
> Any suggestion?

just make the control not-visible is a option
oContrl = oDocDlg.getControl("controlName")
ccontroll.setvisible(false)

i supose you have to "dispose" first te object 
???
ocontrl.dispose
oDocDlg.removeControl(oContrl)

hope it helps a bit

fernand

>
> Thanks,
>
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Remove control from Dlg with code ?
user name
2007-04-11 10:50:18
Hi Fernand,

Fernand Vanrie wrote:
> 
> just make the control not-visible is a option
> oContrl = oDocDlg.getControl("controlName")
> ccontroll.setvisible(false)
No option - with many controls to make and remove, will
become a little 
mess, I'm afraid.

> i supose you have to "dispose" first te
object  ???
> ocontrl.dispose
> oDocDlg.removeControl(oContrl)
But this does work.

Thanks!

Cor

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: Remove control from Dlg with code ?
user name
2007-04-12 02:35:09
Hello Cor,

>>i supose you have to "dispose" first te
object  ???
>>ocontrl.dispose
>>oDocDlg.removeControl(oContrl)
> 
> But this does work.

That's somewhat weird, as manual disposal should never be
necessary.

Your original code was correct - removing the control model
from the
dialog model should automatically also remove the control
from the
dialog. If this isn't the case, please submit an issue.
Thanks.

Ciao
Frank

-- 
- Frank Schönheit, Software Engineer        
frank.schoenheitsun.com -
- Sun Microsystems                      http://www.sun.com/star
office -
- OpenOffice.org Base                       http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )