Sorry for the long post. Here's what I tried hope this helps:
Added a button to Form1.
Added another Form to the project. (Form2)
Added a ComboBox to Form2. Here's the complete code
//// begin unit1
unit unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, Buttons;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
uses unit2;
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var
Count: Integer;
begin
//Form2.Show; // Did work if Form2 wasn't visible. Triggered the
// OnShow Event the first time only.
//Form2.Activate; // Didn't seem to do anything. Did trigger the
// OnActivate Event each time but focus was not changed.
// This is crude but it worked, and triggered the OnShow Event each time.
Form2.Visible := False;
Form2.Visible := True;
end;
initialization
{$I unit1.lrs}
end.
//// end unit1
//// begin unit2
unit unit2;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
TForm2 = class(TForm)
ComboBox1: TComboBox;
procedure Form2Show(Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form2: TForm2;
implementation
{ TForm2 }
procedure TForm2.Form2Show(Sender: TObject);
var
Count: Integer;
begin
Count := ComboBox1.Items.Count + 1;
ComboBox1.Items.Add('Item' + IntToStr(Count));
end;
initialization
{$I unit2.lrs}
end.
//// end unit2