Jump to content

Recommended Posts

Posted
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;

Posted

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.

  • 8 years later...
Posted
On 4/8/2016 at 9:43 PM, Sherzod said:

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.

I tried to do the same, but using UnimEdit and own images. Randomly it only worked ONCE, then I changed to code and it never worked again.

My code now is:

  with TUnimEdit.Create(cp) do begin
         Parent := cp;
         Align:=alTop;
         LayoutConfig.Margin := '3 10 3 35';
         LayoutConfig.Width := '90%';
         LayoutConfig.Height := 'auto';
         EmptyText := 'Write a comment';
         Images := UniMainModule.UniImageList2;
         ClearButton:=False;
         tr:= Triggers.Add;
         tr.ImageIndex := 0;
         tr.Visible:=Visible;
         tr.ButtonId:=0;
         tr.HandleClicks := False;
         CreateOrder:=9;
    end;

UniMainModule.UniImageList2 is filled with 16x16 PNG.

I think, I had a previos version with tr.Create(), it worked. But I am not sure!

Any suggestions very welcome, Meastros!

Posted
Just now, gerhardhziegler said:

I tried to do the same, but using UnimEdit and own images. Randomly it only worked ONCE, then I changed to code and it never worked again.

My code now is:

  with TUnimEdit.Create(cp) do begin
         Parent := cp;
         Align:=alTop;
         LayoutConfig.Margin := '3 10 3 35';
         LayoutConfig.Width := '90%';
         LayoutConfig.Height := 'auto';
         EmptyText := 'Write a comment';
         Images := UniMainModule.UniImageList2;
         ClearButton:=False;
         tr:= Triggers.Add;
         tr.ImageIndex := 0;
         tr.Visible:=Visible;
         tr.ButtonId:=0;
         tr.HandleClicks := False;
         CreateOrder:=9;
    end;

UniMainModule.UniImageList2 is filled with 16x16 PNG.

I think, I had a previos version with tr.Create(), it worked. But I am not sure!

Any suggestions very welcome, Meastros!

btw. I think, the trigger is created, but the image isnt loaded!

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...