En el siguiente ejemplo podemos ver que eventos y como acceder a cada uno de ellos para aplicar nuestro código
personalizado y alterar el funcionamiento de los filtros en un formulario:
Código VB6:
Sub Initialize()
'ActivarScripts para el control del filtro
gForm.Controls("botFiltrar").ActivarScripts = True
End Sub
'-----------
'aIndex = 1: Filtrar
'aIndex = 2: Limpiar
'-----------
'Before
Sub Filtro_BeforeClick(aBotFiltro, aIndex, aCancel)
If aBotFiltro.Name = "botFiltrar" Then
If aIndex = 1 Then 'Filtrar
MsgBox "Before: Estoy filtrando"
End If
If aIndex = 2 Then 'Limpiar
MsgBox "Before: Estoy limpiando"
End If
End If
End Sub
'After
Sub Filtro_AfterClick(aBotFiltro, aIndex)
If aBotFiltro.Name = "botFiltrar" Then
If aIndex = 1 Then 'Filtrar
MsgBox "After: Estoy filtrando"
End If
If aIndex = 2 Then 'Limpiar
MsgBox "After: Estoy limpiando"
End If
End If
End SubCódigo C#:
using AhoraCore;
using AhoraOCX;
using static AhoraCore.VBA.Interaction;
namespace AhoraScriptsPantalla
{
public class AhoraMov_frmMovAlmacen : AhoraOCX.AhoraBaseScript
{
public void Initialize()
{
(gForm.Controls["botFiltrar"] as ICntBotonFiltro).ActivarScripts = true;
}
// -------------
// aIndex = 1: Filtrar
// aIndex = 2: Limpiar
// -------------
public void Filtro_BeforeClick(ICntBotonFiltro aBotFiltro, Valor aIndex, ref Valor aCancel)
{
if (aBotFiltro.Name == "botFiltrar")
{
if (aIndex == 1) // Filtrar
{
MsgBox("Before: Estoy filtrando");
}
if (aIndex == 2) // Limpiar
{
MsgBox("Before: Estoy limpiando");
}
}
}
public void Filtro_AfterClick(ICntBotonFiltro aBotFiltro, Valor aIndex)
{
if (aBotFiltro.Name == "botFiltrar")
{
if (aIndex == 1) // Filtrar
{
MsgBox("After: Estoy filtrando");
}
if (aIndex == 2) // Limpiar
{
MsgBox("After: Estoy limpiando");
}
}
}
}
}