Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

226
Vistas
How do I add an event for a button via code in NativeScript?

I started learning Native Script a few weeks ago, and honestly, I don't like creating an interface through XML, so I want to create it directly through code. Everything was going well until I got to the events.

I have a button:

const btn = new Button();

How do I add an event to it that triggers when I click on it? I know how to do it in XML format, but I want to add an event just like that.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can do that by adding an event listener - see https://v6.docs.nativescript.org/core-concepts/events

I think you'll find after continuing down this path for a while that defining the ui in xml is actually much easier, but your choice.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda