How to delete an MultipleDockable

hello sorry 4 my bad english !!

How can i delete a dockable from the root

i have version 1.1.0

         control = new CControl( this );
		control.getController().setTheme(new  EclipseTheme());
		contentPanel.add( control.getContentArea() );
		
		/* We need to install our EditorFactory early on, otherwise the framework will not
		 * allow us to register the EditorDockables. */
		factory = new EditorFactory();
		control.addMultipleDockableFactory( "file-editor", factory );
		
		
		
		
		
		/* We now create some dockables and drop them onto the content-area */
		grid = new CGrid( control );
		
		
    }
    
    private void initControl(){
    	
    	 dataControl=new Control(this,control,grid,factory);
    	
    	
    	
		grid.add(1, 1, 1, 3, new EditorDockable( factory, new EditorLayout( "Hirarchie" ,  null , new LeftPanel(this)  ) ) ) ;
		grid.add( 2, 4, 1, 1, new EditorDockable( factory, new EditorLayout( "Info", null ,new RaumPanel() ) ) );
		grid.add(2, 4, 1, 1, new EditorDockable( factory, new EditorLayout( "Fehler", null ,new RaumPanel() ) ) );
		}
		
		control.getContentArea().deploy( grid );

	

how can i replace or delete one of this panels(Dockables) from my content area ?

i dont understand why it doesn’t work

:frowning:

for(int i = 0; i < control.getCDockableCount(); i++){
        	MultipleCDockable dockToRemove = (MultipleCDockable) control.getCDockable(i);
          
        	if(dockToRemove.intern().getTitleText().equals(roomName)){
        		
        		control.remove(dockToRemove);
        			
        	}
        	 
          
        }

after removing Dockable and ading a new ist still exist in the GUI why ?

for(int i = 0; i < control.getCDockableCount(); i++){
        	EditorDockable  dockToRemove = (EditorDockable) control.getCDockable(i);
            
          
        	if(dockToRemove.intern().getTitleText().equals(roomName)){
        		dockToRemove.setVisible(false);
        		control.remove(dockToRemove);
        		
        			
        				
        			}	 
          
        }
        ArrayList <ImageComponent>pc=new ArrayList<ImageComponent>();
		for(DataComputer e:dataList){
			
			 pc.add(new  ImageComponent(img,e.getItsPosition()));
			
		}
	
		
    	grid.add( 2, 1, 5.3, 3, new EditorDockable( factory, new EditorLayout( roomName ,  pc ,new RaumPanel()  ) ) );
    	control.getContentArea().deploy( grid );
		

Are you reusing “grid”? In this case the old location information is still stored in grid and your Dockable is re-added (because it is still in “grid”).

To completely replace the layout you’d have to create a new CGrid. If you just want to add a new Dockable you should use “setLocation” and “setVisible(true)” to place your new dockable.

[QUOTE=Beni]Are you reusing “grid”? In this case the old location information is still stored in grid and your Dockable is re-added (because it is still in “grid”).

To completely replace the layout you’d have to create a new CGrid. If you just want to add a new Dockable you should use “setLocation” and “setVisible(true)” to place your new dockable.[/QUOTE]

yeah i re-use the grid but how can i remove it from the grid there is no funktion to remove a Dockable from the grid

The grid exists only to set up an initial layout, once “deploy” has been called it is no longer used by the framework. It’s like you paint your application on a sheet of paper, the “deploy” method then would be the developer that writes your UI using that sheet of paper.

There is no remove method because a CGrid that has been used once should be thrown away. The application can always create a new grid and deploy that one. (But using setLocation/setVisible is the better choice for adding new dockables).

[QUOTE=Beni]The grid exists only to set up an initial layout, once “deploy” has been called it is no longer used by the framework. It’s like you paint your application on a sheet of paper, the “deploy” method then would be the developer that writes your UI using that sheet of paper.

There is no remove method because a CGrid that has been used once should be thrown away. The application can always create a new grid and deploy that one. (But using setLocation/setVisible is the better choice for adding new dockables).[/QUOTE]

sorry didn’t see that with setLocation … THX IT WORKS ! but i have another little problem
how can i set the location like in the grid like that 1, 1, 1, 3 ?

For example like this (all values must be between 0 and 1). For example 0,0,1,0.5 would be the upper half of the frame.

// 0 <= x < 1, 
// 0 <= y < 1, 
// 0 < x + width <= 1, 
// 0 < y + height <= 1
CLocation location = CLocation.base().normalRectangle( 0.25, 0.25, 0.5, 0.5 );
dockable.setLocation( location );```

I'm well aware, that this is not a perfect solution. There are also some other examples [in this thread](http://forum.byte-welt.net/showthread.php?t=3479&page=2).

[QUOTE=Beni]For example like this (all values must be between 0 and 1). For example 0,0,1,0.5 would be the upper half of the frame.

// 0 <= x < 1, 
// 0 <= y < 1, 
// 0 < x + width <= 1, 
// 0 < y + height <= 1
CLocation location = CLocation.base().normalRectangle( 0.25, 0.25, 0.5, 0.5 );
dockable.setLocation( location );```

I'm well aware, that this is not a perfect solution. There are also some other examples [in this thread](http://forum.byte-welt.net/showthread.php?t=3479&page=2).[/QUOTE]

perfect ,  thank you ;)