Coder Social home page Coder Social logo

Comments (11)

barmalei avatar barmalei commented on August 19, 2024

Pay attention zebra on mobile is not something what is completed. It requires investment more time for testing and polishing.

  1. I am testing the latest version of zebra that has to be released soon and will solve such sort of problem
  2. It is impossible to use custom written zebra.ui.TextField component on mobile platform ("thanks" to bloody android ), but you can try to use zebra.ui.HtmlTextField component. zebra.ui.HtmlTextField is wrapped as zebra UI component standard HTML text input element.

Few examples of dummy test zebra mobile application can be found following the links below:
http://zebkit.org/samples/richui.mobile.longlist2.html (you can see zebra implemented inertial scrolling)
http://zebkit.org/samples/richui.mobile.designer.html
http://zebkit.org/samples/richui.mobile.edit.html (here you can see native input text element usage to enter text)

from zebkit.

erny100 avatar erny100 commented on August 19, 2024

ok

About the button , if I use :

 root.find("//Button")._.add(function() {

});

don't work , instead if I add MouseListener to a component it works.

How can I add a MouseListener to a button component ?

another question :)

If I need to search a children into a zebra.ui.Panel with find( path ) , how can I ? where I set id property into the child ?

Thanks

from zebkit.

barmalei avatar barmalei commented on August 19, 2024

Cannot understand the first part of question.
What do you mean saying "if I add MouseListener to a component it works." ?

you can use the following construction to find a children by its property:

yourPanel.find("//*[@id='MyComp']")

the id can be assigned just as a component instance property:

var comp = new Label("My Label");
comp.id = "MyLabel";

or if you are defining your UI in JSON file:

{
    "layout": {  "$zebra.layout.BorderLayout": [] },
    "kids": {
          "TOP": {
               "$zebra.ui.Label": [ "MyLabel" ],
               "id": "MyLabel" 
          }
     }
}

or if you declare your UI following JSON JavaScript style:

root.properties({
     layout: new BorderLayout(),
     kids: {
          TOP: new Label("MyLabel").properties({
                  id: "MyLabel"
           })
    }
});

from zebkit.

erny100 avatar erny100 commented on August 19, 2024
root.find("//Button")._.add(function() {                   
      console.log('' no works (: " )
});


var btn2 = new Panel(MouseListener,Composite, [
          function mousePressed(e){
                      console.log('' works  :)" )
          }
 ]);

from zebkit.

barmalei avatar barmalei commented on August 19, 2024

In the first case you have registered not a mouse listener but a button event listener. The button event is logical, specific for the given component event that is fired when a button has been pressed. If, for some reason, you need to catch button mouse events you can:

  1. override appropriate mouse event handlers methods of the button component:
var button = new Button([
      function mousePressed(e) {
           this.$super(e);  // don't forget call super implementation of the method
           // put some code below
           ... 
      }
]);
  1. You can register global a listener and filter only mouse events that are designated to your particular button component. It can be done via zebra events manager:
zebra.ui.events.addListener(new MouseListener([
    function mousePressed(e) {
        if (e.source == myButton) {
              ... 
        }
    }
]));

from zebkit.

erny100 avatar erny100 commented on August 19, 2024

after soluction 1 , how can I set name button , I don't find into apidoc Class zebra.ui.Button the property.

thanks

from zebkit.

barmalei avatar barmalei commented on August 19, 2024

if you mean a button textual title updating you can do it as follow:

button.kids[0].setValue("New text");

Not very elegant solution, but it is done for the sake of flexibility of button component look and feel customization: every UI component can be used as the button title element. Slightly better looking solution can be the following:

var title = new Label("Button text");
var button = new Button(title);

...

title.setValue("New button text");

from zebkit.

erny100 avatar erny100 commented on August 19, 2024
var button = new Button([
      function mousePressed(e) {
           this.$super(e);  

      }
]);

console.log(button.kids) /// []  no children ?

from zebkit.

barmalei avatar barmalei commented on August 19, 2024

Of course, you have not added any title to the button :). Do it as follow:

var button = new Button("MyTitle", [
    function mousePressed(e) {
        this.$super(e);
        ...
    }
]);

from zebkit.

erny100 avatar erny100 commented on August 19, 2024

thanks :)

have you intension to open a forum about zebra ?

from zebkit.

barmalei avatar barmalei commented on August 19, 2024

No, I don't have enough time to host a forum

from zebkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.