Portal    Foro    Buscar    FAQ    Registrarse    Conectarse


Publicar nuevo tema  Responder al tema 
Página 1 de 1
 
 
Como Detectar Evento En Formulario Creado Por Código?
Autor Mensaje
Responder citando   Descargar mensaje  
Mensaje Como Detectar Evento En Formulario Creado Por Código? 
 

Public Sub MensajeFinalJuego()
 Dim ventana As Form
 Dim boton1 As Button, boton2 As Button
 
 ventana = New Form
 boton1 = New Button(ventana)
 boton2 = New Button(ventana)
 
 With ventana
  .Center
  .Caption = "Advertencia"
  .Width = 600
  .Height = 300
  .Border = False
 End With
 
 With boton1
  .Text = "Estoy seguro, anota"
  .x = 30
  .y = 150
  .Width = 200
  .Height = 50
 End With
 
 With boton2
  .Text = "No anotar"
  .x = 300
  .y = 150
  .Width = 150
  .Height = 50
 End With
 ventana.Show
 
End
 



supongamos que llamo a esa subrutina que crea un formulario y dos botones, mi pregunta es como detecto el evento click en los botones???????  
 




===================
Software libre, programación libre, vida libre es la Public function Libertad()as Invendible
Proyectos: VisorRV1960,Taller2015,Tanteador
https://sourceforge.net/u/v3ctor-full/profile/
Blog: http://novatocodegambas.blogspot.com.uy/
 
v3ctor - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Como Detectar Evento En Formulario Creado Por Código? 
 
Ante todo tienes que atribuir ellos a un grupo de eventos.
Por ejemplo:
....
 boton1 = New Button(ventana) As "NombreDelGrupo"
 boton2 = New Button(ventana) As "NombreDelGrupo"
....
....
End

Public Sub NombreDelGrupo_Click()
  
' Identificamos el Button presionado por una su propiedad... por ejemplo el su texto:
Select Case Last.Text
  Case "Estoy seguro, anota"
    Print "Apretado el button1"
  Case "No anotar"
    Print "Apretado el button2"
End Select
 
End


Es claro que tu puedes atribuir cada boton a un propio unico grupo.
 



 
última edición por vuott el Viernes, 27 Junio 2014, 16:17; editado 3 veces 
vuott - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Como Detectar Evento En Formulario Creado Por Código? 
 
gracias vuott

' gambas module file


Public Sub MensajeFinalJuego()
 Dim ventana As Form
 Dim boton1 As Button, boton2 As Button
 
 ventana = New Form
 boton1 = New Button(ventana) As "boton1"
 boton2 = New Button(ventana) As "boton2"
 
 With ventana
  .Center
  .Caption = "Advertencia"
  .Width = 600
  .Height = 300
  .Border = False
 End With
 
 With boton1
  .Text = "Estoy seguro, anota"
  .x = 30
  .y = 150
  .Width = 200
  .Height = 50
 End With
 
 With boton2
  .Text = "No anotar"
  .x = 300
  .y = 150
  .Width = 150
  .Height = 50
 End With
 ventana.Show
 
End

Public Sub boton1_Click()
  
  Print "presionaste boton1"
  
End
Public Sub boton2_Click()
  
  Print "presionaste boton2"
  
End

 




===================
Software libre, programación libre, vida libre es la Public function Libertad()as Invendible
Proyectos: VisorRV1960,Taller2015,Tanteador
https://sourceforge.net/u/v3ctor-full/profile/
Blog: http://novatocodegambas.blogspot.com.uy/
 
v3ctor - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: Como Detectar Evento En Formulario Creado Por Código? 
 
v3ctor escribió: [Ver mensaje]

boton1 = New Button(ventana) As "boton1"
 boton2 = New Button(ventana) As "boton2"
 .....
 
End

Public Sub boton1_Click()
  
  Print "presionaste boton1"
  
End
Public Sub boton2_Click()
  
  Print "presionaste boton2"
  
End


Exactamente. Has atribuido cada boton a un su proprio unico grupo. Està bien.
 



 
última edición por vuott el Viernes, 27 Junio 2014, 16:19; editado 1 vez 
vuott - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Mostrar mensajes anteriores:    
 
OcultarTemas parecidos
Tema Autor Foro Respuestas último mensaje
No hay nuevos mensajes Como Generar Un Evento Creado Por Ti? v3ctor General 9 Miercoles, 06 Enero 2016, 11:29 Ver último mensaje
jsbsan
No hay nuevos mensajes ¿Como Detectar El Evento Clear En Un DirBox? v3ctor General 2 Jueves, 24 Noviembre 2016, 18:24 Ver último mensaje
shordi
No hay nuevos mensajes Detectar Evento Enter En Una Key De Un Tre... v3ctor General 6 Domingo, 16 Julio 2017, 19:48 Ver último mensaje
jsbsan
No hay nuevos mensajes Como Detectar Evento Click En Notify-send v3ctor Mundo Linux 0 Miercoles, 08 Agosto 2018, 11:32 Ver último mensaje
v3ctor
 

Publicar nuevo tema  Responder al tema  Página 1 de 1
 

Usuarios navegando en este tema: 0 registrados, 0 ocultos y 1 invitado
Usuarios registrados conectados: Ninguno


 
Lista de permisos
No puede crear mensajes
No puede responder temas
No puede editar sus mensajes
No puede borrar sus mensajes
No puede votar en encuestas
No puede adjuntar archivos
Puede descargar archivos
No puede publicar eventos en el calendario



  

 

cron