Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 09:24 Go to next message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
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 12:13 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
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 11:45 Go to previous messageGo to next message
Phil Wim is currently offline Phil WimFriend
Messages: 89
Registered: October 2013
Member
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 10:24 Go to previous message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 699
Registered: July 2009
Senior Member
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 Apr 26 12:19:08 GMT 2024

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

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

Back to the top