Shikhar13 / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

Pointerpress on button in form in html does not fire actionPerformed event. #143

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
<html>
<head>

</head>
<body>  
<form action="some command to post back" method="post" id="id_problem">
  <p>
    <input type="reset" value="Close" name="exit" id="exit" />
  </p>      
</form>
</body>
</html>

Load that up, and use your mouse to click the button. Nothing will happen (even 
after enabling events). Hitting the ENTER button on my keyboard fires the 
keypress event which fires the actionPerformed event.

Original issue reported on code.google.com by jkoo...@gmail.com on 11 Apr 2012 at 11:50

GoogleCodeExporter commented 9 years ago
Pasted this in the kitchen sink demo and it works as expected:
        HTMLComponent h = (HTMLComponent)wb.getInternal();
        h.setEventsEnabled(true);
        h.setHTMLCallback(new HTMLCallback() {

            public void titleUpdated(HTMLComponent htmlC, String title) {
                System.out.println("titleUpdated");
            }

            public void pageStatusChanged(HTMLComponent htmlC, int status, String url) {
                System.out.println("pageStatusChanged");
            }

            public String fieldSubmitted(HTMLComponent htmlC, TextArea ta, String actionURL, String id, String value, int type, String errorMsg) {
                System.out.println("fieldSubmitted");
                return null;
            }

            public String getAutoComplete(HTMLComponent htmlC, String actionURL, String id) {
                System.out.println("getAutoComplete");
                return null;
            }

            public int getLinkProperties(HTMLComponent htmlC, String url) {
                System.out.println("getLinkProperties");
                return 0;
            }

            public boolean linkClicked(HTMLComponent htmlC, String url) {
                System.out.println("linkClicked");
                return true;
            }

            public void actionPerformed(ActionEvent evt, HTMLComponent htmlC, HTMLElement element) {
                System.out.println("actionPerformed");
            }

            public void focusGained(Component cmp, HTMLComponent htmlC, HTMLElement element) {
                System.out.println("focusGained");
            }

            public void focusLost(Component cmp, HTMLComponent htmlC, HTMLElement element) {
                System.out.println("focusLost");
            }

            public void selectionChanged(int oldSelected, int newSelected, HTMLComponent htmlC, List list, HTMLElement element) {
                System.out.println("selectionChanged");
            }

            public void dataChanged(int type, int index, HTMLComponent htmlC, TextField textField, HTMLElement element) {
                System.out.println("dataChanged");
            }

            public boolean parsingError(int errorId, String tag, String attribute, String value, String description) {
                System.out.println("parsingError");
                return true;
            }
        });

Original comment by shai.almog on 12 Apr 2012 at 6:21