PDA

View Full Version : ContentPanel header and TextFields



nleonard
10 Nov 2009, 5:22 PM
Hello,

I've just figured out this bug:

Description: I cannot enter text in TextFields included in the header of a ComponentLabel because of the "x-unselectable" style applied by default to the header of a ComponentLabel.

Browser: webkit (tested on Chrome 4.0.237.0 / Safari) (it works under IE / Firefox)

Workaround : override onRender() in a class derived from ComponentPanel,
this.getHeader().disableTextSelection(false);
Drawback: the header title text is selectable.

I don't know what the default browser behavior should be in that case, so I don't know if it's a browser or an ext-gwt bug.

Thx

Nicolas

Arno.Nyhm
11 Nov 2009, 2:35 AM
thanks for the workaround.


but: i dont know a "componentlabel" :-(

maybe you give a small (working) codesnippet to see what you do and to know where your workaround is needed (also user with the same problem can better search for commands and methods and can find better your workaround).

thx

nleonard
11 Nov 2009, 3:23 AM
Oups .. I was tired, ComponentLabel = ContentPanel

In my case (I will provide a short snippet asap), it was a StoreFilterField in a ContentPanel.

Thx

nleonard
12 Nov 2009, 2:43 AM
Here it is:



import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;

public class Delegate implements EntryPoint
{
public void onModuleLoad()
{
Viewport viewport = new Viewport();
viewport.setLayout(new FitLayout());

ContentPanel cp = new ContentPanel();
cp.setHeading( "Header" );

cp.getHeader().addTool( new TextField<String>() );

viewport.add(cp);
RootPanel.get().add(viewport);
}
}

Under chrome, no way to write any character in the textfield.

sven
12 Nov 2009, 3:51 AM
There are css rules that make it unselectable. You need to remove these. Just use the inspector.

Arno.Nyhm
12 Nov 2009, 4:27 AM
or use the workaround from posting #1:




package com.mycompany.myapplication.client.forumsnippets;

/**
*
* @author arno.nyhm
*/

import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Viewport;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.RootPanel;

public class ForumThread407893ToolInHeader implements EntryPoint {

public void onModuleLoad() {
Viewport viewport = new Viewport();
viewport.setLayout(new FitLayout());

ContentPanel cp = new ContentPanel() {

@Override
protected void onRender(Element parent, int pos) {
super.onRender(parent, pos);
this.getHeader().disableTextSelection(false);
}

};
cp.setHeading("Header");

cp.getHeader().addTool(new TextField<String>());

viewport.add(cp);
RootPanel.get().add(viewport);
}
}