eclipsesource / tabris

Tabris for Eclipse RAP
https://eclipsesource.com/products/tabris
53 stars 18 forks source link

textfield.setFocus has no effect while opening a page #439

Closed KathrinKieckbusch closed 7 years ago

KathrinKieckbusch commented 8 years ago

Hello we want to open the keyboard when we open the page. With Android we setFocus on the textfield but with iOS it doesn't work. Is there an option for iOS that the keyboard occurs immediately?

patrykmol commented 8 years ago

Hi. Are you testing if hardware keyboard attached? If yes, disable it. On-screen keyboard won't show when it is attached.

KathrinKieckbusch commented 8 years ago

How can we disable it?

patrykmol commented 8 years ago

It is an option in simulator (Hardware -> Keyboard -> Connect hardware keyboard). If it's a device you have turn off the keyboard.

KathrinKieckbusch commented 8 years ago

We are not doing the testing on the simulator, we are doing the testing live on an iPhone. Sry for the missunderstanding. But even if we remove the hardware keyboard in the simulator it doesnt work there. It seems like the 'textfield.setFokus' ist not translated in something like [textfield becomeFirstResponder].

patrykmol commented 8 years ago

It seems that setFocus doesn't work if it's invoked just after creating the control. Can you delay invoking this method (like set time and then use it)?

KathrinKieckbusch commented 8 years ago

I tried it unfortunately it doesn't work.. Do you know another possibility?

patrykmol commented 8 years ago

Unfortunately no. We will fix it in July's release.

KathrinKieckbusch commented 8 years ago

Ok thanks very much. We have still another problem. We use a verifyListener on a TextField. With the verifyListener we catch all letters because its a number field. When the user enters a letter the verifyListener opens a ClientDialog and deletes the letter. That's great. But when the user enters again the verifyListener checks the textField a few times an opens the ClientDialog twice. And when the user enters third times a letter the verifyListener checks again a few times and opens the ClientDialog also twice. That problem only occures on Android. On iOS the verifyListener checks the textFied once per enter no matter how often we entered a letter. Ist that a fault in our code?

patrykmol commented 8 years ago

Can you open separate issue for this? It will be easier to track.

KathrinKieckbusch commented 7 years ago

Hello, we tested 'setFocus()' with the new tabris version but the keyboard appears just for a few seconds. What can we do that the keyboard stays open?

evolanakis commented 7 years ago

I can reproduce the issue.

KathrinKieckbusch commented 7 years ago

When do you resolve this problem?

evolanakis commented 7 years ago

Analysis

This is a bug in the iOs client. The client sets the focus into the text field correctly when creating the page. After the UI is created the page sets the focus on itself (PageViewController -viewDidAppear).

A new build of the iOs client will be required to fix the issue.

Workaround

No known workaround.

Snippets

One can use these pages to reproduce the issue:


public class TopLevelPage extends AbstractPage {
    @Override
    public void createContent(final Composite parent, PageData data) {
        Button button = new Button(parent, SWT.PUSH);
        button.setText("Open page");
        button.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                getUI().getPageOperator().openPage("page");
            }
        });
    }
}

public class Page extends AbstractPage {
    @Override
    public void createContent(final Composite parent, PageData data) {
        parent.setLayout(new GridLayout(1, false));
        Text text = new Text(parent, SWT.BORDER);
        text.setFocus();
    }
}
evolanakis commented 7 years ago

This has been fixed, pending review.