www.pudn.com > Roulette.rar > playeredit.pas


unit playeredit; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, StdCtrls, Mask, DBCtrls, TltConst; 
 
type 
  TPlayerEditForm = class(TForm) 
    Label1: TLabel; 
    Label2: TLabel; 
    Label3: TLabel; 
    Label4: TLabel; 
    Button2: TButton; 
    Button3: TButton; 
    Edit1: TEdit; 
    Edit2: TEdit; 
    Edit3: TEdit; 
    Edit4: TEdit; 
    Label5: TLabel; 
    Edit5: TEdit; 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 
 
  function EditPlayer(var APlayerEditInfo : TPlayerEditInfo): boolean; 
 
implementation 
 
{$R *.dfm} 
 
function EditPlayer(var APlayerEditInfo : TPlayerEditInfo): boolean; 
var 
  PlayerEditForm: TPlayerEditForm; 
begin 
  Result := false; 
  try 
    PlayerEditForm := TPlayerEditForm.Create(nil); 
    if APlayerEditInfo.EditFlag=efEditPlayer then begin 
      PlayerEditForm.Edit3.Enabled:=False; 
      PlayerEditForm.Edit3.Color:=PlayerEditForm.Edit1.Color; 
    end else begin 
      PlayerEditForm.Edit3.Enabled:=True; 
      PlayerEditForm.Edit3.Color:=clWindow; 
    end; 
    PlayerEditForm.Edit1.Text := APlayerEditInfo.PlayerInfo.ID; 
    PlayerEditForm.Edit2.Text := APlayerEditInfo.PlayerInfo.password; 
    PlayerEditForm.Edit3.Text := IntToStr(APlayerEditInfo.PlayerInfo.money); 
    PlayerEditForm.Edit4.Text := APlayerEditInfo.PlayerInfo.Memo; 
    PlayerEditForm.Edit5.Text := APlayerEditInfo.PlayerInfo.UserName; 
    if PlayerEditForm.ShowModal = mrOK then begin 
      APlayerEditInfo.PlayerInfo.money := StrToInt(PlayerEditForm.Edit3.Text); 
      APlayerEditInfo.PlayerInfo.Password := (PlayerEditForm.Edit2.Text); 
      APlayerEditInfo.PlayerInfo.UserName := PlayerEditForm.Edit5.Text; 
      APlayerEditInfo.PlayerInfo.Memo := PlayerEditForm.Edit4.Text; 
      Result := true; 
    end; 
  finally 
    PlayerEditForm.Free; 
  end; 
end; 
 
end.