Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
KathrinKieckbusch opened this issue Jun 20, 2016 · 14 comments
Closed

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

KathrinKieckbusch opened this issue Jun 20, 2016 · 14 comments
Assignees

Comments

@KathrinKieckbusch
Copy link

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
Copy link

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

@KathrinKieckbusch
Copy link
Author

How can we disable it?

@patrykmol
Copy link

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

@KathrinKieckbusch
Copy link
Author

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
Copy link

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
Copy link
Author

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

@patrykmol
Copy link

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

@KathrinKieckbusch
Copy link
Author

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
Copy link

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

@KathrinKieckbusch
Copy link
Author

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
Copy link
Member

I can reproduce the issue.

@KathrinKieckbusch
Copy link
Author

When do you resolve this problem?

@evolanakis
Copy link
Member

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 evolanakis changed the title textfield.setFocus textfield.setFocus has no effect while opening a page Nov 28, 2016
@evolanakis
Copy link
Member

This has been fixed, pending review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants