Skip to main content



      Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMFForms] Setting default focus on control of ViewModel(Need to set Focus on the first, or a chosen Control of ECPSWTView)
[EMFForms] Setting default focus on control of ViewModel [message #1426832] Fri, 19 September 2014 05:24 Go to next message
Eclipse UserFriend
Is there a way to set the focus to a specific control of my ViewModel, yet?

If no, wouldn't it be a nice feature to set it in the related ViewModel?

Cheers
Philippe
Re: [EMFForms] Setting default focus on control of ViewModel [message #1426911 is a reply to message #1426832] Fri, 19 September 2014 08:13 Go to previous messageGo to next message
Eclipse UserFriend
Hi Phil,

do you mean the initial focus? At the moment it is always the first in
the widget hierachy.

Cheers

Jonas

Am 19.09.2014 11:24, schrieb Phil Wim:
> Is there a way to set the focus to a specific control of my ViewModel, yet?
>
> If no, wouldn't it be a nice feature to set it in the related ViewModel?
>
> Cheers
> Philippe
Re: [EMFForms] Setting default focus on control of ViewModel [message #1455458 is a reply to message #1426911] Wed, 29 October 2014 07:45 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jonas,

like you said. The focus is set to the first visible widget. Finally i had to override the setVisible of my WizardPage to see the focus:

@Override
public void setVisible(boolean visible) {
    super.setVisible(visible);
    if (visible) {
        Control control = getControl();
        if (!control.setFocus()) {
            postSetFocus(control);
        }
    }
}

private void postSetFocus(final Control control) {
    Display display = control.getDisplay();
    if (display != null) {
        display.asyncExec(new Runnable() {
            @Override
            public void run() {
                control.setFocus();
            }
        });
    }
}


I want to archive the same for my Editor. I saw in MEEditorPage an overwritten setFocus() and form.setShowFocusedControl(true). I have the same structure for my editor. But still no focus on the first visible widget.

Anyl ideas?
Re: [EMFForms] Setting default focus on control of ViewModel [message #1456407 is a reply to message #1455458] Thu, 30 October 2014 06:24 Go to previous message
Eclipse UserFriend
Hi,

so you implemented your own editor, which embeds EMF Forms? And you do
not want to focus the first control, but a specific one?
Could you report a Bug for that, preferably with an example to reproduce.

Best regards

Jonas


Am 29.10.2014 12:45, schrieb Phil Wim:
> Hi Jonas,
>
> like you said. The focus is set to the first visible widget. Finally i
> had to override the setVisible of my WizardPage to see the focus:
>
>
> @Override
> public void setVisible(boolean visible) {
> super.setVisible(visible);
> if (visible) {
> Control control = getControl();
> if (!control.setFocus()) {
> postSetFocus(control);
> }
> }
> }
>
> private void postSetFocus(final Control control) {
> Display display = control.getDisplay();
> if (display != null) {
> display.asyncExec(new Runnable() {
> @Override
> public void run() {
> control.setFocus();
> }
> });
> }
> }
>
>
> I want to archive the same for my Editor. I saw in MEEditorPage an
> overwritten setFocus() and form.setShowFocusedControl(true). I have the
> same structure for my editor. But still no focus on the first visible
> widget.
> Anyl ideas?
Previous Topic:[EMFForms] EKeys on EReference validation constrain only fired on initial AddCommand
Next Topic:"New model element" dialog shows wrong elements
Goto Forum:
  


Current Time: Fri Jul 18 23:05:28 EDT 2025

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

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

Back to the top