Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Is it possible hide a form?(Eclipse Scout Kepler)
Is it possible hide a form? [message #1456521] Thu, 30 October 2014 12:51 Go to next message
marco giudici is currently offline marco giudiciFriend
Messages: 204
Registered: February 2013
Location: Italy
Senior Member
Hi all,
I would need to hide, but not to close, a form when I open another.

I try to clarify my request: when my application start show two form, form A and form B. Form A have with some fields and one button; form B have a tree field and other fields. These two form are respectly defined as display view North and South.
When I click on one node of the tree field, a new form C is opened but I want hide form A and B.

Is it possible make this operation in Scout?
If yes, how?

Thanks in advance for any help and explanation
Re: Is it possible hide a form? [message #1456546 is a reply to message #1456521] Thu, 30 October 2014 13:22 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Just for me to understand: all your forms are displayed as view?
Are you using Swing, Swt or Rap?

.
Re: Is it possible hide a form? [message #1456550 is a reply to message #1456546] Thu, 30 October 2014 13:27 Go to previous messageGo to next message
marco giudici is currently offline marco giudiciFriend
Messages: 204
Registered: February 2013
Location: Italy
Senior Member
Hi Jeremie,
yes, all my form are displayed as view and I use my application both in SWT and RAP.

Form A : view in position North
Form B : view in position South
Form C : view actualy in position Center, but I would fill out the window
Re: Is it possible hide a form? [message #1458397 is a reply to message #1456550] Sat, 01 November 2014 10:03 Go to previous messageGo to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
The best I have managed for the moment is to close the forms opened as other view:

List<IForm> viewStack = getDesktop().getViewStack();
for (IForm f : viewStack) {
  if (IForm.VIEW_ID_N.equals(f.getDisplayViewId()) || IForm.VIEW_ID_S.equals(f.getDisplayViewId())) {
    f.doClose();
  }
}
BigForm f = new BigForm();
f.startModify();
f.activate();


I will ask for some other advices.
Re: Is it possible hide a form? [message #1460116 is a reply to message #1456521] Mon, 03 November 2014 07:50 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 256
Registered: March 2010
Senior Member
Hi

You can use getDesktop().removeForm() to hide a form. You can show the form again by using getDesktop().addForm. The model of the form (field values etcs.) stays untouched.

--
Claudio
Re: Is it possible hide a form? [message #1460213 is a reply to message #1460116] Mon, 03 November 2014 10:12 Go to previous messageGo to next message
marco giudici is currently offline marco giudiciFriend
Messages: 204
Registered: February 2013
Location: Italy
Senior Member
Thank you both for your suggestions.

I'm following the suggestion of Claudio, because it seems the easiest and most adaptable solution to my situation.

if I have questions or problems on this path, I will ask you more advice.
Re: Is it possible hide a form? [message #1460233 is a reply to message #1460213] Mon, 03 November 2014 10:39 Go to previous message
marco giudici is currently offline marco giudiciFriend
Messages: 204
Registered: February 2013
Location: Italy
Senior Member
Hi all,
I want share the solution that I find for this type of situation.

I have two forms that are showed immediately when my application starts; these two forms are opened respectly in North and South area.
When I open a new form, I want hide these two forms and show the new one in the Center area to occupy all space in the window.

To do that I define an arraylist that contains the form that I hide and the following methods in the new form that I ask to open:

...
  private ArrayList<IForm> formIds = new ArrayList<IForm>();
...

  public class NewHandler extends AbstractFormHandler {

    @Override
    public void execLoad() throws ProcessingException {
      INewFormService service = SERVICES.getService(INewFormService.class);
      NewFormFormData formData = new NewFormFormData();
      exportFormData(formData);
      formData = service.prepareCreate(formData);
      importFormData(formData);

      //Check the list of Form opened in position North and South to hide
      IForm[] viewStack = getDesktop().getViewStack();
      for (IForm f : viewStack) {
        if (IForm.VIEW_ID_N.equals(f.getDisplayViewId()) || IForm.VIEW_ID_S.equals(f.getDisplayViewId())) {
          formIds.add(f);
          getDesktop().removeForm(f);
        }
      }

    }

...

  @Override
  protected void execDisposeForm() throws ProcessingException {
    //Check the list of Form opened but hide to show again
    if (!formIds.isEmpty()) {
      for (IForm f : formIds) {
        getDesktop().addForm(f);
      }
    }

  }



I hope this can help someone else who has the same need
Previous Topic:How to fix broken Service Registration
Next Topic:ServiceRegistration and generics
Goto Forum:
  


Current Time: Thu Mar 28 10:57:26 GMT 2024

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

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

Back to the top