selectform.~pas

来自「delphi 和mapx联合开发的例程 实现mapx的相应功能」· ~PAS 代码 · 共 72 行

~PAS
72
字号
unit SelectForm;
interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls;

type
  TShowType = (stSelection, stStat);

  TSelectFrm = class(TForm)
    Panel1: TPanel;
    GroupBox1: TGroupBox;
    ListBox1: TListBox;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
    Handle: THandle;
    ShowType: TShowType;
  public
    { Public declarations }
    Procedure SetContext(aHandle: Thandle; aItem: string; aShowType: TShowType);
  end;

implementation

uses uMsgConst;


{$R *.dfm}
procedure TSelectFrm.BitBtn1Click(Sender: TObject);
var
  AMessage: TMessage;
begin
  if ListBox1.ItemIndex <> -1 then
  begin
    if ShowType = stSelection then
      AMessage.Msg:= SELECTION_DETAIL_MSG   // 信息齐全了
    else if ShowType = stStat then
      AMessage.Msg:= STAT_DETAIL_MSG;   // 信息齐全了
    SendMessage(Handle,AMessage.Msg,0,0);
  end
  else
    Application.MessageBox('请选择一条记录!','提示信息!',mb_ok);
end;


procedure TSelectFrm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action:= cahide;
end;

procedure TSelectFrm.BitBtn2Click(Sender: TObject);
begin
  Close;
end;

procedure TSelectFrm.SetContext(aHandle: Thandle; aItem: string; aShowType: TShowType);
begin
  if Handle <> aHandle then
    Handle:= aHandle;
  if  ShowType <> aShowType then
    ShowType:= aShowType;
  ListBox1.Items.add(aItem);
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?