FormPage Scrolling Problem [message #409727] |
Sat, 12 February 2005 20:12 |
Sebastian Messages: 26 Registered: July 2009 |
Junior Member |
|
|
Hi there, i hava a problem with FormPage and Scolling.
My FormPageŽs createFormContent Method creates some Buttons, Labels and a
Table, which is to big to display at once on the screen. The Scrollbar
scrolls the whole content, but i only want the table to scroll. I tried to
use Form instead of ScolledForm, but it does not work.
In fact i want to get all the capabilities of a form, but without
scrolling.
Quick and dirty, i have owerwrite the following methods:
public void createPartControl(Composite parent) {
form = editor.getToolkit().createForm(parent);
// instead of 'editor.getToolkit().createScolledForm(parent);'
ManagedForm mform = new ManagedForm(parent);
createFormContent(mform);
}
public Control getPartControl() {
return form;
}
public void setActive(boolean active) {
}
This works, but i think there is another, better way.
Thanks for support me.
Sebastian
|
|
|
|
|
Re: FormPage Scrolling Problem [message #409745 is a reply to message #409743] |
Mon, 14 February 2005 13:20 |
Daniel Rohe Messages: 63 Registered: July 2009 |
Member |
|
|
You could reimplement the Interface IFormPage and create a ScrolledForm
without Scrollbars. The problem is that the IManagedForm always requires a
ScrolledForm. I think it is correct to have a ScrolledForm as root form,
because you could not forbid your user to minimize the editor so that only
the buttons are visible or only one button is visible. When the user resizes
the Eclipse workbench some buttons of your page could be out of the visible
area and are not reachable without scrollbars.
Another point is your quick and dirty hack:
public void createPartControl(Composite parent) {
form = editor.getToolkit().createForm(parent);
// instead of 'editor.getToolkit().createScolledForm(parent);'
ManagedForm mform = new ManagedForm(parent);
createFormContent(mform);
}
public Control getPartControl() {
return form;
}
public void setActive(boolean active) {
}
In the first line of createPartControl you create a simple Form, ok. In the
third line you create a new ManagedForm. The constructor of the ManagedForm
creates internal a ScrolledForm.
Then in the fourth line you call createFormContent with the ManagedForm. Do
you use the variable form or mForm.getForm() as composite parent for other
widgets? The method getPartControl returns the control of the editor page,
that is your variable form, which is a Form and has no scrolling. Are your
buttons, labels and tables children of the form or children of
mForm.getForm()?
What about lifecycle methods? What is when the user changes something in the
table or text field? There must be a root form, that is capable of managing
dirty and stale states. In the FormPage the root form is an instance of
PageForm which is a child of ManagedForm. When the editor input changes the
ManagedForm refreshes the FormParts. Also when the user enters something the
ManagedForm changes the dirty state of the editor.
In the "Eclipse Forms Programming Guide" they meant when you have a larger
UI component and want to embed a form without scrolling into it. Then you
should use Form instead of ScrolledForm. But a FormPage is a page in a
multi-page editor and is a root UI component, so it should have scrolling
capabilities.
Greetings
Daniel
"Sebastian" <voss-news@gmx.de> schrieb im Newsbeitrag
news:cuq3j5$9l6$1@www.eclipse.org...
> Thank you for answering my question.
>
> I tried to use your code. Now the table is scrollable, but my FormPage is
> it too. I want to turn off scrolling of FormPage.
>
> "Eclipse Forms Programming Guide" says:
>
> "The last item in the list needs some clarification. In some instances,
> you will want to make the form be a child of a more complex layout that is
> itself capable of scrolling. In that case, you may want to get all the
> capabilities of a form, but without scrolling. In that case you would use
> the class Form instead of ScrolledForm (in fact, ScrolledForm has-a Form
> as an internal object and delegates most of the methods like setText to
> it)."
>
> But how can i use Form instead of ScrolledForm? FormPage creates per
> default a ScrolledForm.
>
>
>
> Daniel Rohe wrote:
>
>> The table widget is a widget that supports scrolling because it is
>> derived from Scrollable. You have to enable it with the styles
>> SWT.H_SCROLL and SWT.V_SCROLL.
>
>> createFormContent(IManagedForm managedForm) {
>> FormToolkit toolkit = managedForm.getToolkit();
>> ScrolledForm form = managedForm.getForm();
>
>> Composite body = form.getBody();
>> // create the table in body and enable scrolling
>> Table table = toolkit.createTable(body, SWT.H_SCROLL | SWT.V_SCROLL);
>> }
>
>
|
|
|
Re: FormPage Scrolling Problem [message #447555 is a reply to message #409727] |
Mon, 10 April 2006 22:12 |
Eclipse User |
|
|
|
Originally posted by: pratvenk.cisco.com
Hi,
I am trying to get my forms to be scrollable, but am having issues. The problem is that when my form is not showing all of the content in it, I need to resize the form, b/c I can't see the scrollbar.
When I resize the form, the scrollbar appears for a brief second and then disappears. So the only way I can see the contents of the form is to resize it. I have the following code in my forms -
protected void createFormContent(IManagedForm managedForm) {
super.createFormContent(managedForm);
FormToolkit toolkit = managedForm.getToolkit();
ScrolledForm form = managedForm.getForm();
form.setBackground(SWTResourceManager.getColor(192, 192, 192));
form.setExpandHorizontal(true);
form.setExpandVertical(true);
form.setText("Column Object");
Composite composite = form.getBody();
form.setMinSize(300, 800);
form.setContent(composite);
...
}
Anyone know why this might be happening?
Thanks.
|
|
|
Re: FormPage Scrolling Problem [message #447795 is a reply to message #447555] |
Sun, 16 April 2006 16:36 |
Alexander Karnstedt Messages: 68 Registered: July 2009 |
Member |
|
|
I think, after adding all the content to the ScrolledForm, you have to
call form.reflow(true) to cause the ScrolledForm recalculating it's
actual size.
Alex
PRATHIMA VENKATESAN schrieb:
> Hi,
>
> I am trying to get my forms to be scrollable, but am having issues. The problem is that when my form is not showing all of the content in it, I need to resize the form, b/c I can't see the scrollbar.
>
> When I resize the form, the scrollbar appears for a brief second and then disappears. So the only way I can see the contents of the form is to resize it. I have the following code in my forms -
>
> protected void createFormContent(IManagedForm managedForm) {
> super.createFormContent(managedForm);
>
> FormToolkit toolkit = managedForm.getToolkit();
> ScrolledForm form = managedForm.getForm();
>
> form.setBackground(SWTResourceManager.getColor(192, 192, 192));
> form.setExpandHorizontal(true);
> form.setExpandVertical(true);
> form.setText("Column Object");
>
> Composite composite = form.getBody();
>
> form.setMinSize(300, 800);
>
> form.setContent(composite);
>
> ...
> }
>
> Anyone know why this might be happening?
>
> Thanks.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04725 seconds