Object Events

Tagged: 

This topic contains 6 replies, has 3 voices, and was last updated by  Mark Sibly 2 years, 3 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #6338

    APC
    Participant

    How can I capture the events from the Button, TextField, CheckBox etc from the code below.

    Please create a dir called gui and add the image attached to it

    Attachments:
    #6340

    peterigz
    Participant

    I’m just starting to learn mojox too. According to the documents each gadget/widget like buttons has different fields that invoke a method or lambda. Here’s some examples for the code you gave, and my preferred way which would be to extend the element and keep the events separate in their own class (see MyButton below). This is similar to how wxWidgets works. But I’m a newb so maybe someone else can chime in as well 🙂

    #6343

    APC
    Participant

    Hello peterigz,

    Thank you for your response, where did you find this information?

    After creating a button with image or text when I try to get the Width and Height it returns 0

    The button Width and Height are read only.

    #6349

    peterigz
    Participant

    I’m just using the docs here and trying to figure things out by looking at the source code for Ted2. I think I’ll write a tutorial for mojox once I’ve figured most things out, I like the look of mojox so far I think it’ll be nice to work with.

    Regarding the sizes, try using MeasuredSize which is a property that returns a Vec2.

    #6355

    APC
    Participant

    peterigz,

    I tried <span class=”crayon-sy”>.</span><span class=”crayon-v”>MeasuredSize</span><span class=”crayon-sy”>.</span><span class=”crayon-i”>x and <span class=”crayon-sy”>.</span><span class=”crayon-v”>MeasuredSize</span><span class=”crayon-sy”>.y, they both returned 0.</span></span>

    I use in Monkey 1  for about 4 years, and I love what they did to Monkey 2. I also used Pyro from Planiax http://www.playniax.com/pyro.html

    They did a great job writing Pyro 2 for Monkey 2

    #6359

    peterigz
    Participant

    Ahh, possibly you’re trying to get the size before mojox has actually figured out what size they should be? Try a bit later on in the process after View.OnMeasure has been called (I’m not sure when that is though exactly or if you can hook into it somehow)

    #6362

    Mark Sibly
    Keymaster

    Have a look in the modules/mojox/tests directory for some fairly useful how-to mojox examples.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.