Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » org.eclipse.swt.widgets.Text and Scroll bar(Not able to influence scroll bar on FF)
org.eclipse.swt.widgets.Text and Scroll bar [message #529715] Mon, 26 April 2010 21:53 Go to next message
Ed  is currently offline Ed
Messages: 4
Registered: April 2010
Junior Member
In a simple usage of org.eclipse.swt.widgets.Text as text area(within a RAP1.2.2 application) I see scrolling behavior issue between FF and IE. When my text exceeds the height of the text area, I use setSelection(last-char-position) and the V-Scroll bar in IE moves to the bottom of the text area but in FF the scroll bar always stays at the top so user has to manullay scroll it to the bottom.
I have been trying to find a way to influence the V-Scroll bar on Text widgets but have no luck.
I am also puzzled about some of the internals of this Widget. By looking at the Eclipse APIs I thought since Text is extending Scroallable I should be able to access the following method and maybe influence the scroll bar:

public ScrollBar getVerticalBar()

I had no luck accessing this method from my text object. It acts like that it never meant to be used by public.

I appreciate for any hits/pointers or clarificationson this topic.

Ed

[Updated on: Mon, 26 April 2010 21:56]

Report message to a moderator

Re: org.eclipse.swt.widgets.Text and Scroll bar [message #530376 is a reply to message #529715] Thu, 29 April 2010 14:17 Go to previous messageGo to next message
Praveen  is currently offline Praveen
Messages: 86
Registered: July 2009
Member
> Scroallbale I should be able to access the following method and maybe
> influence the scroll bar:
> public ScrollBar getVerticalBar()
>
> I had no luck accessing this method from my text object. It acts like
> that it never meant to be used by public.
getVerticalBar() is meant to be used as a public API for users. Text
widget has access to these scrollbars as it extends scrollbar. It can be
used for moving the scrollbar programmatically. Would you let me know
the exact inability of the scrollbar you are seeing ?
Re: org.eclipse.swt.widgets.Text and Scroll bar [message #530451 is a reply to message #530376] Thu, 29 April 2010 16:38 Go to previous message
Ed  is currently offline Ed
Messages: 4
Registered: April 2010
Junior Member
Thanks for your relpy!
Yes, according to Javadocs, getVerticalBar() is public and should be accessible but the issue that I see is that I cannot get to it.

I worte a little hello sample and used the reflection just to show you what methods I can ge to. As you see

textArea = new Text(parent, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL | SWT.BORDER | SWT.READ_ONLY);
textArea.setText("Hello\n");

Method [] mds = textArea.getClass().getMethods();
for (Method md : mds) {
System.out.println("method["+md+"]");
}

Output:
method[public boolean java.lang.Object.equals(java.lang.Object)]
method[public native int java.lang.Object.hashCode()]
method[public java.lang.String org.eclipse.swt.widgets.Widget.toString()]
method[public java.lang.Object org.eclipse.swt.widgets.Text.getAdapter(java.lang.Class)]
method[public java.lang.Object org.eclipse.swt.widgets.Widget.getData()]
method[public void org.eclipse.swt.widgets.Widget.setData(java.lang.Object)]
method[public java.lang.Object org.eclipse.swt.widgets.Widget.getData(java.lang.String)]
method[public void org.eclipse.swt.widgets.Widget.setData(java.lang.String,java .lang.Object)]
method[public org.eclipse.swt.widgets.Display org.eclipse.swt.widgets.Widget.getDisplay()]
method[public int org.eclipse.swt.widgets.Widget.getStyle()]
method[public void org.eclipse.swt.widgets.Widget.addDisposeListener(org.eclips e.swt.events.DisposeListener)]
method[public void org.eclipse.swt.widgets.Widget.removeDisposeListener(org.ecl ipse.swt.events.DisposeListener)]
method[public void org.eclipse.swt.widgets.Widget.addListener(int,org.eclipse.s wt.widgets.Listener)]
method[public void org.eclipse.swt.widgets.Widget.removeListener(int,org.eclips e.swt.widgets.Listener)]
method[public void org.eclipse.swt.widgets.Widget.notifyListeners(int,org.eclip se.swt.widgets.Event)]
method[public void org.eclipse.swt.widgets.Widget.dispose()]
method[public boolean org.eclipse.swt.widgets.Widget.isDisposed()]
method[public org.eclipse.swt.widgets.Composite org.eclipse.swt.widgets.Control.getParent()]
method[public org.eclipse.swt.widgets.Shell org.eclipse.swt.widgets.Control.getShell()]
method[public org.eclipse.swt.widgets.Monitor org.eclipse.swt.widgets.Control.getMonitor()]
method[public void org.eclipse.swt.widgets.Control.setVisible(boolean)]
method[public boolean org.eclipse.swt.widgets.Control.isVisible()]
method[public boolean org.eclipse.swt.widgets.Control.getVisible()]
method[public void org.eclipse.swt.widgets.Control.setEnabled(boolean)]
method[public boolean org.eclipse.swt.widgets.Control.getEnabled()]
method[public boolean org.eclipse.swt.widgets.Control.isEnabled()]
method[public void org.eclipse.swt.widgets.Control.setBackground(org.eclipse.sw t.graphics.Color)]
method[public org.eclipse.swt.graphics.Color org.eclipse.swt.widgets.Control.getBackground()]
method[public void org.eclipse.swt.widgets.Control.setBackgroundImage(org.eclip se.swt.graphics.Image)]
method[public org.eclipse.swt.graphics.Image org.eclipse.swt.widgets.Control.getBackgroundImage()]
method[public void org.eclipse.swt.widgets.Control.setForeground(org.eclipse.sw t.graphics.Color)]
method[public org.eclipse.swt.graphics.Color org.eclipse.swt.widgets.Control.getForeground()]
method[public void org.eclipse.swt.widgets.Control.setFont(org.eclipse.swt.grap hics.Font)]
method[public org.eclipse.swt.graphics.Font org.eclipse.swt.widgets.Control.getFont()]
method[public void org.eclipse.swt.widgets.Control.setCursor(org.eclipse.swt.gr aphics.Cursor)]
method[public org.eclipse.swt.graphics.Cursor org.eclipse.swt.widgets.Control.getCursor()]
method[public boolean org.eclipse.swt.widgets.Control.setFocus()]
method[public boolean org.eclipse.swt.widgets.Control.forceFocus()]
method[public boolean org.eclipse.swt.widgets.Control.isFocusControl()]
method[public org.eclipse.swt.graphics.Rectangle org.eclipse.swt.widgets.Control.getBounds()]
method[public void org.eclipse.swt.widgets.Control.setBounds(org.eclipse.swt.gr aphics.Rectangle)]
method[public void org.eclipse.swt.widgets.Control.setBounds(int,int,int,int)]
method[public void org.eclipse.swt.widgets.Control.setLocation(org.eclipse.swt. graphics.Point)]
method[public void org.eclipse.swt.widgets.Control.setLocation(int,int)]
method[public org.eclipse.swt.graphics.Point org.eclipse.swt.widgets.Control.getLocation()]
method[public void org.eclipse.swt.widgets.Control.setSize(org.eclipse.swt.grap hics.Point)]
method[public void org.eclipse.swt.widgets.Control.setSize(int,int)]
method[public org.eclipse.swt.graphics.Point org.eclipse.swt.widgets.Control.getSize()]
method[public org.eclipse.swt.graphics.Point org.eclipse.swt.widgets.Control.computeSize(int,int)]
method[public org.eclipse.swt.graphics.Point org.eclipse.swt.widgets.Text.computeSize(int,int,boolean)]
method[public void org.eclipse.swt.widgets.Control.pack()]
method[public void org.eclipse.swt.widgets.Control.pack(boolean)]
method[public int org.eclipse.swt.widgets.Control.getBorderWidth()]
method[public org.eclipse.swt.graphics.Point org.eclipse.swt.widgets.Control.toControl(int,int)]
method[public org.eclipse.swt.graphics.Point org.eclipse.swt.widgets.Control.toControl(org.eclipse.swt.gr aphics.Point)]
method[public org.eclipse.swt.graphics.Point org.eclipse.swt.widgets.Control.toDisplay(int,int)]
method[public org.eclipse.swt.graphics.Point org.eclipse.swt.widgets.Control.toDisplay(org.eclipse.swt.gr aphics.Point)]
method[public java.lang.Object org.eclipse.swt.widgets.Control.getLayoutData()]
method[public void org.eclipse.swt.widgets.Control.setLayoutData(java.lang.Obje ct)]
method[public void org.eclipse.swt.widgets.Control.setToolTipText(java.lang.Str ing)]
method[public java.lang.String org.eclipse.swt.widgets.Control.getToolTipText()]
method[public void org.eclipse.swt.widgets.Control.setMenu(org.eclipse.swt.widg ets.Menu)]
method[public org.eclipse.swt.widgets.Menu org.eclipse.swt.widgets.Control.getMenu()]
method[public void org.eclipse.swt.widgets.Control.moveAbove(org.eclipse.swt.wi dgets.Control)]
method[public void org.eclipse.swt.widgets.Control.moveBelow(org.eclipse.swt.wi dgets.Control)]
method[public void org.eclipse.swt.widgets.Control.addControlListener(org.eclip se.swt.events.ControlListener)]
method[public void org.eclipse.swt.widgets.Control.removeControlListener(org.ec lipse.swt.events.ControlListener)]
method[public void org.eclipse.swt.widgets.Control.addMouseListener(org.eclipse .swt.events.MouseListener)]
method[public void org.eclipse.swt.widgets.Control.removeMouseListener(org.ecli pse.swt.events.MouseListener)]
method[public void org.eclipse.swt.widgets.Control.addKeyListener(org.eclipse.s wt.events.KeyListener)]
method[public void org.eclipse.swt.widgets.Control.removeKeyListener(org.eclips e.swt.events.KeyListener)]
method[public void org.eclipse.swt.widgets.Control.addTraverseListener(org.ecli pse.swt.events.TraverseListener)]
method[public void org.eclipse.swt.widgets.Control.removeTraverseListener(org.e clipse.swt.events.TraverseListener)]
method[public void org.eclipse.swt.widgets.Control.addFocusListener(org.eclipse .swt.events.FocusListener)]
method[public void org.eclipse.swt.widgets.Control.removeFocusListener(org.ecli pse.swt.events.FocusListener)]
method[public void org.eclipse.swt.widgets.Control.setRedraw(boolean)]
method[public void org.eclipse.swt.widgets.Control.redraw()]
method[public org.eclipse.swt.graphics.Rectangle org.eclipse.swt.widgets.Scrollable.getClientArea()]
method[public org.eclipse.swt.graphics.Rectangle org.eclipse.swt.widgets.Text.computeTrim(int,int,int,int)]
method[public void org.eclipse.swt.widgets.Text.setText(java.lang.String)]
method[public java.lang.String org.eclipse.swt.widgets.Text.getText()]
method[public void org.eclipse.swt.widgets.Text.append(java.lang.String)]
method[public java.lang.String org.eclipse.swt.widgets.Text.getLineDelimiter()]
method[public int org.eclipse.swt.widgets.Text.getLineHeight()]
method[public void org.eclipse.swt.widgets.Text.setTextLimit(int)]
method[public int org.eclipse.swt.widgets.Text.getTextLimit()]
method[public int org.eclipse.swt.widgets.Text.getCharCount()]
method[public void org.eclipse.swt.widgets.Text.setSelection(int)]
method[public void org.eclipse.swt.widgets.Text.setSelection(int,int)]
method[public void org.eclipse.swt.widgets.Text.setSelection(org.eclipse.swt.gr aphics.Point)]
method[public org.eclipse.swt.graphics.Point org.eclipse.swt.widgets.Text.getSelection()]
method[public int org.eclipse.swt.widgets.Text.getSelectionCount()]
method[public java.lang.String org.eclipse.swt.widgets.Text.getSelectionText()]
method[public void org.eclipse.swt.widgets.Text.clearSelection()]
method[public void org.eclipse.swt.widgets.Text.selectAll()]
method[public void org.eclipse.swt.widgets.Text.setEditable(boolean)]
method[public boolean org.eclipse.swt.widgets.Text.getEditable()]
method[public void org.eclipse.swt.widgets.Text.insert(java.lang.String)]
method[public void org.eclipse.swt.widgets.Text.addSelectionListener(org.eclips e.swt.events.SelectionListener)]
method[public void org.eclipse.swt.widgets.Text.removeSelectionListener(org.ecl ipse.swt.events.SelectionListener)]
method[public void org.eclipse.swt.widgets.Text.addModifyListener(org.eclipse.s wt.events.ModifyListener)]
method[public void org.eclipse.swt.widgets.Text.removeModifyListener(org.eclips e.swt.events.ModifyListener)]
method[public void org.eclipse.swt.widgets.Text.addVerifyListener(org.eclipse.s wt.events.VerifyListener)]
method[public void org.eclipse.swt.widgets.Text.removeVerifyListener(org.eclips e.swt.events.VerifyListener)]
method[public final native java.lang.Class java.lang.Object.getClass()]
method[public final native void java.lang.Object.notify()]
method[public final native void java.lang.Object.notifyAll()]
method[public final void java.lang.Object.wait() throws java.lang.InterruptedException]
method[public final void java.lang.Object.wait(long) throws java.lang.InterruptedException]
method[public final native void java.lang.Object.wait(long,int) throws java.lang.InterruptedException]

The only method accessible from Scrollable is the following:
org.eclipse.swt.widgets.Scrollable.getClientArea()

Again, I am using this code within a RAP 1.2.2 application with Eclipse 3.4.2.

Previous Topic:Gray ExpandBar on Vista
Next Topic:Hide/Show MenuItems in a Menu
Goto Forum:
  


Current Time: Sun Oct 26 07:54:35 GMT 2014

Powered by FUDForum. Page generated in 0.01628 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software