Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
44.184 Beiträge
 
Delphi 12 Athens
 
#10

Re: Ereignisse eines Forms in anderer Unit verarbeiten

  Alt 20. Apr 2004, 13:10
Code:
unit device;

interface

uses kl2700,Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Menus, ComCtrls, StdCtrls, ExtCtrls;

type
  TDevice1 = class(TForm)
    procedure DevCBChange(Sender: TObject);
  public
    procedure DevRep[color=red](Form: TForm)[/color];
  end;

[color=red]var Dev1: TDevice1;[/color]

implementation

procedure TDevice1.DevCBChange(Sender: TObject);
begin
ShowMessage('Läuft');
end;

procedure TDevice1.DevRep[color=red](Form: TForm)[/color];
const DevNames: array[0..5] of ShortString = ('KL2700','KL487','KL195','HP3440','HP4284','HP6622' );
var ListItem: TStrings;
    i,IndexDList: Integer;
    st_d1:String;

begin
with TCombobox.Create([color=red]Form[/color]) do
  begin
    Parent:=[color=red]Form[/color];
    top:=12;
    left:=8;
    For i:=0 to 5 do
      IndexDList := Items.Add(DevNames[i]);
    ItemIndex:=0;
    OnChange := [color=red]DevCBChange;[/color]
  end;
End;

end.
Delphi-Quellcode:
// Hauptunit
Dev1.DevRep(Form1);
$2B or not $2B
  Mit Zitat antworten Zitat