unit OptionClass;
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
interface
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Utilities, StdCtrls, Buttons, ShellApi, ShlObj, UtilitiesOwn,
OptionClassGen, StrUtils;
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
const
em=16000;
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
type
TOptionDialog = class(TOptionDialogGen)
OKButton: TButton;
Label3: TLabel;
Label4: TLabel;
Label6: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Button2: TButton;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
ftpuser: TLabel;
ftppassword: TLabel;
Edit7: TEdit;
Label1: TLabel;
Edit6: TEdit;
Label2: TLabel;
Edit8: TEdit;
Schlag: TLabel;
Etag1: TEdit;
Etag2: TEdit;
Etag3: TEdit;
Etag4: TEdit;
Etag5: TEdit;
Etag6: TEdit;
Etag7: TEdit;
Label5: TLabel;
Tag1: TLabel;
Tag2: TLabel;
Tag3: TLabel;
Tag4: TLabel;
Tag5: TLabel;
Tag6: TLabel;
Etag8: TEdit;
Etag9: TEdit;
Tag7: TLabel;
Tag8: TLabel;
Reset: TButton;
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
Procedure InitOptions(optionsfilename:PChar);
procedure ResetClick(Sender: TObject);
procedure OKButtonClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
var
Opt:TOptionDialog;
StartFolder:String;
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
implementation
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
{$R *.dfm}
{------------------------------------------------------------------}
{- Procedure getOptions -}
{- set Options -}
{------------------------------------------------------------------}
Procedure TOptionDialog.InitOptions(optionsfilename:PChar);
var x:integer;
function m(N:real):String;begin M:=midstr(inttostr(round(n)),2,10); end;
begin
Opt:=TOptionDialog.create(nil);
if Not FileExists(optionsfilename) then begin
defaultoptions(Opt.R);
Opt.PutOptions(optionsfilename)
end;
Opt.getoptions(optionsfilename);
if Opt.r.inited<>'j' then begin
DefaultOptions(Opt.R);
end;
x:=Opt.OptLen();
if x>maxoptsize then begin
Error(911,'wrong size');
ExitProcess(911);
end;
end;{GetOptions}
//------------------------------------------------------------------------------
// externalcode from delphi.about.com -- Windows Code !!
//------------------------------------------------------------------------------
function BrowseDialogCallBack
(Wnd: HWND; uMsg: UINT; lParam, lpData: LPARAM):
integer stdcall;
var
wa, rect : TRect;
dialogPT : TPoint;
begin
//center in work area
if uMsg = BFFM_INITIALIZED then
begin
wa := Screen.WorkAreaRect;
GetWindowRect(Wnd, Rect);
dialogPT.X := ((wa.Right-wa.Left) div 2) - ((rect.Right-rect.Left) div 2);
dialogPT.Y := ((wa.Bottom-wa.Top) div 2) - ((rect.Bottom-rect.Top) div 2);
MoveWindow(Wnd,dialogPT.X,dialogPT.Y,Rect.Right - Rect.Left,
Rect.Bottom - Rect.Top,True);
SendMessage(Wnd,BFFM_SETSELECTION, 1, Integer(@StartFolder[1]));
end;
Result := 0;
end;
//------------------------------------------------------------------------------
// externalcode from delphi.about.com -- Windows Code !!
//------------------------------------------------------------------------------
function BrowseDialog(const Title: string; const Flag: integer): string;
var
lpItemID : PItemIDList;
BrowseInfo : TBrowseInfo;
DisplayName : array[0..MAX_PATH] of char;
TempPath : array[0..MAX_PATH] of char;
begin
Result:='';
FillChar(BrowseInfo, sizeof(TBrowseInfo), #0);
with BrowseInfo do begin
hwndOwner := Application.Handle;
pszDisplayName := @DisplayName;
lpszTitle := PChar(Title);
ulFlags := Flag;
lpfn := BrowseDialogCallBack;
end;
lpItemID := SHBrowseForFolder(BrowseInfo);
if lpItemId <> nil then begin
SHGetPathFromIDList(lpItemID, TempPath);
Result := TempPath;
GlobalFreePtr(lpItemID);
end;
end;
//----------------------------------------------------------------------------
// Zurücksetzen
//----------------------------------------------------------------------------
procedure TOptionDialog.ResetClick(Sender: TObject);
begin
DefaultOptions(Opt.R);
Opt.putoptions(PChar(OptionsfileName(Title)));
Showmessage('Bitte starten Sie das Programm erneut.');
ExitProcess(711);
end;
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
procedure TOptionDialog.OKButtonClick(Sender: TObject);
begin
//inherited;
Close();
end;
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
procedure TOptionDialog.SpeedButton1Click(Sender: TObject);
var sTitle, sFolder: string;
iFlag : integer;
begin
sTitle:='Verzeichnis auswählen';
iFlag := BIF_RETURNONLYFSDIRS;
if Edit1.text<>'' then StartFolder:=Edit1.text;
sFolder := BrowseDialog(sTitle, iFlag);
if sFolder <> '' then
edit1.text := sFolder+'\';
end;
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
procedure TOptionDialog.SpeedButton2Click(Sender: TObject);
var sTitle, sFolder: string;
iFlag : integer;
begin
sTitle:='Verzeichnis auswählen';
iFlag := BIF_RETURNONLYFSDIRS;
if Edit2.text<>'' then StartFolder:=Edit2.text;
sFolder := BrowseDialog(sTitle, iFlag);
if sFolder <> '' then
edit2.text := sFolder+'\';
end;
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
procedure TOptionDialog.SpeedButton3Click(Sender: TObject);
var sTitle, sFolder: string;
iFlag : integer;
begin
sTitle:='Verzeichnis auswählen';
iFlag := BIF_RETURNONLYFSDIRS;
if Edit3.text<>'' then StartFolder:=Edit3.text;
sFolder := BrowseDialog(sTitle, iFlag);
if sFolder <> '' then
edit3.text := sFolder+'\';
end;
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
procedure TOptionDialog.SpeedButton4Click(Sender: TObject);
var sTitle, sFolder: string;
iFlag : integer;
begin
sTitle:='Verzeichnis auswählen';
iFlag := BIF_RETURNONLYFSDIRS;
sFolder := BrowseDialog(sTitle, iFlag);
end;
{------------------------------------------------------------------}
{- -}
{- Ende dieser Quelle -}
{- -}
{------------------------------------------------------------------}
end.
¤ Dauer der Verarbeitung: 0.23 Sekunden
(vorverarbeitet)
¤
|
Haftungshinweis
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.
|