home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
pctchnqs
/
1991
/
number5
/
dlg
/
dlgsave.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-10-01
|
3KB
|
127 lines
{ dlgsave.pas by Tom Swan -- Demonstrate transfer record }
program DlgSave;
{$IFDEF BWCC}
{$R notes.res}
uses WinTypes, WinProcs, WObjectB, IDs;
{$ELSE}
{$R notesx.res}
uses WinTypes, WinProcs, WObjects, IDs;
{$ENDIF}
const
len_KeyWords = 80;
len_Source = 64;
len_Date = 10;
len_CrossRef = 64;
len_Remarks = 4096;
num_Sources = 3;
Sources: array[0 .. num_Sources - 1] of PChar = (
'PC Techniques',
'Dr. Dobbs Journal',
'Computer Language'
);
type
TComboTransferRec = record
Strings: PStrCollection;
Selection: array[0 .. len_Source] of Char;
end;
TDlgRec = record
KeyWords: array[0 .. len_KeyWords] of Char;
Source: TComboTransferRec;
Date: array[0 .. len_Date] of Char;
CrossRef: array[0 .. len_CrossRef] of Char;
Remarks: array[0 .. len_Remarks] of Char;
Note: Word;
Mail: Word;
Todo: Word;
Urgent: Word;
Done: Word;
end;
TDlgApp = object(TApplication)
procedure InitMainWindow; virtual;
end;
PDlgWin = ^TDlgWin;
TDlgWin = object(TWindow)
DlgRec: TDlgRec;
constructor Init(AParent: PWindowsObject; ATitle: PChar);
destructor Done; virtual;
procedure CMDialogDisplay(var Msg: TMessage);
virtual cm_First + cm_DialogShow;
end;
PDlg = ^TDlg;
TDlg = object(TDialog)
constructor Init(AParent: PWindowsObject; ATitle: PChar);
end;
procedure TDlgApp.InitMainWindow;
begin
MainWindow := New(PDlgWin, Init(nil, 'DlgSave'));
end;
constructor TDlgWin.Init(AParent: PWindowsObject; ATitle: PChar);
var
I: Integer;
begin
TWindow.Init(AParent, ATitle);
Attr.Menu := LoadMenu(HInstance, PChar(id_Menu));
FillChar(DlgRec, Sizeof(TDlgRec), 0);
with DlgRec, Source do
begin
Strings := New(PStrCollection, Init(10, 10));
for I := 0 to num_Sources - 1 do
Strings^.Insert(Sources[I]);
Note := 1; { Set default radio button }
end;
end;
destructor TDlgWin.Done;
begin
with DlgRec.Source do if Strings <> nil then
begin
Strings^.DeleteAll;
Dispose(Strings, Done);
end;
TWindow.Done;
end;
procedure TDlgWin.CMDialogDisplay(var Msg: TMessage);
var DialogP: PDialog;
begin
DialogP := New(PDlg, Init(@Self, PChar(id_NotesDlg)));
DialogP^.TransferBuffer := @DlgRec;
Application^.ExecDialog(DialogP);
end;
constructor TDlg.Init(AParent: PWindowsObject; ATitle: PChar);
var
X: PControl; { Throw-away control object pointer }
begin
TDialog.Init(AParent, ATitle);
X := New(PEdit, InitResource(@Self, dlg_KeyWords, len_KeyWords + 1));
X := New(PComboBox, InitResource(@Self, dlg_Source, len_Source + 1));
X := New(PEdit, InitResource(@Self, dlg_Date, len_Date + 1));
X := New(PEdit, InitResource(@Self, dlg_CrossRef, len_CrossRef + 1));
X := New(PEdit, InitResource(@Self, dlg_Remarks, len_Remarks + 1));
X := New(PRadioButton, InitResource(@Self, dlg_Note));
X := New(PRadioButton, InitResource(@Self, dlg_Mail));
X := New(PRadioButton, InitResource(@Self, dlg_Todo));
X := New(PCheckBox, InitResource(@Self, dlg_Urgent));
X := New(PCheckBox, InitResource(@Self, dlg_Done));
end;
var
DlgApp: TDlgApp;
begin
DlgApp.Init('DlgShow');
DlgApp.Run;
DlgApp.Done;
end.