Jump to content

OnTriggerEvent - Runtime (Help Me!!!)


herculanojs

Recommended Posts

I'm having trouble in assigning TriggerEvent when we created the component at runtime. The award of the event simply does not work. But if the event is already assigned to a component already created, it works. What should you do following example?

 

 

Tengo problemas en la asignación de eventos TriggerEvent  cuando creamos el componente en tiempo de ejecución. El premio del evento no funciona. Pero si el evento ya está asignado a un componente ya creado, funciona. ¿Qué debo hacer? 

 

procedure TMainForm.UniComboBox1TriggerEvent(Sender: TUniCustomComboBox;AButtonId: Integer);

begin

        ShowMessage (IntToStr (AButtonId));

end;

 

with TUniComboBox(InsertControl(TUniComboBox.Create(self))) do

begin

       Left: = 100;

       Width: = 300;

       Top: = 200;

       OnTriggerEvent: = UniComboBox1TriggerEvent;

end;

Link to comment
Share on other sites

Hi,

 

For example:

procedure TMainForm.UniButton1Click(Sender: TObject);
var
  trigger: TUniComboTrigger;
begin
  with TUniComboBox.Create(Self) do 
  begin
    Parent := Self;
    Left := UniButton1.Left;
    Top := UniButton1.Top - 50;
    OnTriggerEvent := UniComboBox1TriggerEvent;

    trigger := Triggers.Add;
    trigger.ButtonId := 0;
    trigger.HandleClicks := False;

    trigger := Triggers.Add;
    trigger.ButtonId := 1;
    trigger.HandleClicks := True;
    trigger.IconCls := 'x-form-date-trigger';

    trigger := Triggers.Add;
    trigger.ButtonId := 2;
    trigger.HandleClicks := True;
    trigger.IconCls := 'x-form-search-trigger';
  end;
end;

Best regards.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...