home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / ptgenr2.zip / BBDLG.PAS next >
Pascal/Delphi Source File  |  1994-08-01  |  37KB  |  1,280 lines

  1. { Created : 18-02-'91
  2.  
  3. Uses string identifiers 1920..1930
  4. Uses object type identifiers 1920..1930
  5.  
  6. Last changes :
  7. 93-09-16  Created from PrintError a procedure type, else all of TurboVision
  8.           would be linked in because of the Application = nil check and
  9.           possibly subsequent call to MsgBox
  10. 93-09-22  Adapted to BBGui wrapper
  11. 93-09-24  Moved DisposeSItem from BBUtil to this unit
  12. 93-12-21  Added procedure PrintWarning
  13. 93-12-22  Enhanced TListViewer2 and TListBox2 to speed up selection by adding
  14.           support to select an item by typed characters
  15.           Removed cmBEditItem, cmBDeleteItem and cmBInsertItem. Their current
  16.           use was unclear
  17. 93-12-23  Fixed bug in InputString which would input only uppercase characters
  18.           Added procedure ShowHelpWindow which displays a given helpwindow
  19. 94-01-07  Added cmBEDitItem, cmBDeleteItem and cmBInsertItem again. These
  20.           commands were for buttons which should not be disabeld after
  21.           a ListBox releases its focus!
  22. 94-01-14  Added procedure ViewAsText, copied from tvfm
  23. 94-03-05  Added RegisterBBDlg procedure
  24. }
  25.  
  26.  
  27. {$IFDEF DPMI}
  28. {$X+,S-,I-,V-}
  29. {$ELSE}
  30. {$X+,O+,F+,I-,R-,Q-,S-,V-,D-}
  31. {$ENDIF}
  32. unit BBDlg;
  33.  
  34. interface
  35.  
  36. uses Objects, Drivers, Menus, Views, Dialogs;
  37.  
  38.  
  39. const
  40.  
  41. { Message box classes }
  42.  
  43.   mfWarning      = $0000;       { Display a Warning box }
  44.   mfError        = $0001;       { Dispaly a Error box }
  45.   mfInformation  = $0002;       { Display an Information Box }
  46.   mfConfirmation = $0003;       { Display a Confirmation Box }
  47.  
  48. { Message box button flags }
  49.  
  50.   mfYesButton    = $0100;       { Put a Yes button into the dialog }
  51.   mfNoButton     = $0200;       { Put a No button into the dialog }
  52.   mfOKButton     = $0400;       { Put an OK button into the dialog }
  53.   mfCancelButton = $0800;       { Put a Cancel button into the dialog }
  54.   mfHelpButton   = $1000;       { Put a Help button into the dialog }
  55.  
  56.   mfYesNoCancel  = mfYesButton + mfNoButton + mfCancelButton;
  57.                                 { Standard Yes, No, Cancel dialog }
  58.   mfOKCancel     = mfOKButton + mfCancelButton;
  59.                                 { Standard OK, Cancel dialog }
  60.   mfOKCancelHelp = mfOKButton + mfCancelButton + mfHelpButton;
  61.  
  62.                                 { Standard OK, Cancel, Help dialog }
  63. const
  64.   PassWordLen = 8;
  65.  
  66.  
  67. {* allowed chars used by InputString *}
  68. const
  69.   Numbers = '0123456789';
  70.   Capitals = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  71.   LowerCase = 'abcdefghijklmnopqrstuvwxyz';
  72.   AllChars = '';
  73.  
  74. const
  75.   cmEditItem    = 240;       {* bind these two to *}
  76.   cmDeleteItem  = 241;       {* the keyboard *}
  77.   cmInsertItem  = 242;
  78.   cmBEditItem   = 243;       {* these are for buttons which should *}
  79.   cmBDeleteItem = 244;       {* not be disabled when a listbox releases *}
  80.   cmBInsertItem = 245;       {* its focus *}
  81.  
  82. {* the following commands are defined so that existing code does not break *}
  83. {* on the removal of language dependency from BBDlg *}
  84. const
  85.   English = 0;
  86.   Dutch = 0;
  87.  
  88. {* the following commands are defined so that existing code does not
  89.    break on the removal of AnswerType *}
  90. const
  91.   Yes = cmYes;
  92.   No = cmNo;
  93.   Cancel = cmCancel;
  94.  
  95. type
  96.   PPopupMenu = ^TPopupMenu;
  97.   TPopupMenu = object(TMenuPopup)
  98.     destructor Done;  virtual;
  99.   end;
  100.  
  101.   PSpinButton = ^TSpinButton;
  102.   TSpinButton = object(TRadioButtons)
  103.     constructor Init(var Bounds : TRect; AStrings : PSItem);
  104.     procedure Draw;  virtual;
  105.     procedure HandleEvent(var Event : TEvent);  virtual;
  106.   end;
  107.  
  108.   PXInputLine = ^TXInputLine;
  109.   TXInputLine = object(TInputLine)
  110.     procedure HandleEvent(var Event : TEvent);  virtual;
  111.   end;
  112.  
  113. const
  114.   RightMouseButtonIsEdit:Boolean = TRUE;    {* when right mouse button is *}
  115.                                             {* pressed in list box,       *}
  116.                                             {* activate EditItem method?  *}
  117.  
  118. type
  119.   PListViewer2 = ^TListViewer2;
  120.   TListViewer2 = object(TListViewer)
  121.     TypedStr : PString;
  122.     TypedStrIndex : word;
  123.     constructor Init(var Bounds: TRect; ANumCols: Integer; AHScrollBar, AVScrollBar: PScrollBar);
  124.     procedure HandleEvent(var Event : TEvent);  virtual;
  125.     procedure InsertItem;  virtual;
  126.     procedure DeleteItem;  virtual;
  127.     procedure EditItem;  virtual;
  128.   end;
  129.  
  130. {* listbox record to be used by Get- or SetData *}
  131.   TListBoxRec = record
  132.     List: PCollection;
  133.     Selection: Word;
  134.   end;
  135.  
  136.   PListBox2 = ^TListBox2;
  137.   TListBox2 = object(TListBox)
  138.     TypedStr : PString;
  139.     TypedStrIndex : word;
  140.     constructor Init(var Bounds: TRect; ANumCols: Integer; AVScrollBar: PScrollBar);
  141.     procedure HandleEvent(var Event : TEvent);  virtual;
  142.     procedure InsertItem;  virtual;
  143.     procedure DeleteItem;  virtual;
  144.     procedure EditItem;  virtual;
  145.   end;
  146.  
  147.   PParamInputBox = ^TParamInputBox;
  148.   TParamInputBox = object(TListBox2)
  149.     procedure InsertItem;  virtual;
  150.     procedure DeleteItem;  virtual;
  151.     procedure EditItem;  virtual;
  152.   end;
  153.  
  154.   PStringInputBox = ^TStringInputBox;
  155.   TStringInputBox = object(TListBox2)
  156.     procedure InsertItem;  virtual;
  157.     procedure DeleteItem;  virtual;
  158.     procedure EditItem;  virtual;
  159.   end;
  160.  
  161.  
  162. procedure DisposeSItem(PS : PSItem);
  163.  
  164. procedure PrintError(const s : string; AHelpCtx : word);
  165. procedure PrintWarning(const s : string; AHelpCtx : word);
  166. function  PromptUser(const s : string; AHelpCtx : word) : word;
  167. function  UserAnswer(const s : string; AHelpCtx : word) : word;
  168. function  popAnswer(const s : string; AHelpCtx : word) : word;
  169. function  InputString(Header : string; var s : string; len : word; AllowedChars : string; AHelpCtx : word) : word;
  170. function  InputWord(Header : string; var w : word; len : word; AHelpCtx : word) : word;
  171. procedure InfoBox(const s : string; AHelpCtx : word);
  172. function  ExecDialog(P : PDialog; Data : pointer): word;
  173. function  CheckExecDialog(P : PDialog; Data: pointer; DataSize : word): word;
  174. function  PassWord(const s : string; AHelpCtx : word) : Boolean;
  175. procedure InsertButtons(Dialog : PDialog; AOptions : word);
  176.  
  177. { procedures to show a progress dialog box }
  178.  
  179. procedure OpenProgressDlg(const ATitle : string; ATotal : longint);
  180. procedure CloseProgressDlg;
  181. procedure SetProgressDlg(Position : longint);
  182. procedure ProgressDlgNewText(const s : string);
  183.  
  184.  
  185. { procedure to popup a help window }
  186.  
  187. procedure ShowHelpWindow(const FileName : string; HelpCtx : word);
  188.  
  189.  
  190. { procedure to insert window with a text file as contents }
  191.  
  192. procedure ViewAsText(const FileName: FNameStr);
  193.  
  194.  
  195. { MessageBox displays the given string in a standard sized      }
  196. { dialog box. Before the dialog is displayed the Msg and Params }
  197. { are passed to FormatStr.  The resulting string is displayed   }
  198. { as a TStaticText view in the dialog.                          }
  199.  
  200. function MessageBox(const Msg: string; Params: pointer; AOptions: word;
  201.   AHelpCtx : word): word;
  202.  
  203. { MessageBoxRec allows the specification of a TRect for the     }
  204. { message box to occupy.                                        }
  205.  
  206. function MessageBoxRect(var R: TRect; const Msg: string; Params: pointer;
  207.   AOptions: word; AHelpCtx : word): word;
  208.  
  209.  
  210.  
  211. procedure RegisterBBDlg;
  212.  
  213.  
  214. const
  215.   RPopupMenu: TStreamRec = (
  216.     ObjType: 1920;
  217.     VmtLink: Ofs(TypeOf(TPopupMenu)^);
  218.     Load:    @TPopupMenu.Load;
  219.     Store:   @TPopupMenu.Store
  220.   );
  221.  
  222. const
  223.   RSpinButton: TStreamRec = (
  224.     ObjType: 1921;
  225.     VmtLink: Ofs(TypeOf(TSpinButton)^);
  226.     Load:    @TSpinButton.Load;
  227.     Store:   @TSpinButton.Store
  228.   );
  229.  
  230. const
  231.   RXInputLine : TStreamRec = (
  232.     ObjType: 1922;
  233.     VmtLink: Ofs(TypeOf(TXInputLine)^);
  234.     Load:    @TXInputLine.Load;
  235.     Store:   @TXInputLine.Store
  236.   );
  237.  
  238. const
  239.   RListViewer2: TStreamRec = (
  240.     ObjType: 1923;
  241.     VmtLink: Ofs(TypeOf(TListViewer2)^);
  242.     Load:    @TListViewer2.Load;
  243.     Store:   @TListViewer2.Store
  244.   );
  245.  
  246. const
  247.   RListBox2: TStreamRec = (
  248.     ObjType: 1924;
  249.     VmtLink: Ofs(TypeOf(TListBox2)^);
  250.     Load:    @TListBox2.Load;
  251.     Store:   @TListBox2.Store
  252.   );
  253.  
  254. const
  255.   RParamInputBox: TStreamRec = (
  256.     ObjType: 1925;
  257.     VmtLink: Ofs(TypeOf(TParamInputBox)^);
  258.     Load:    @TParamInputBox.Load;
  259.     Store:   @TParamInputBox.Store
  260.   );
  261.  
  262. const
  263.   RStringInputBox: TStreamRec = (
  264.     ObjType: 1926;
  265.     VmtLink: Ofs(TypeOf(TStringInputBox)^);
  266.     Load:    @TStringInputBox.Load;
  267.     Store:   @TStringInputBox.Store
  268.   );
  269.  
  270.  
  271.  
  272.  
  273.  
  274. implementation
  275.  
  276. uses App, HelpFile, Editors, ViewText,
  277.      BBConst, BBGui, BBUtil, BBFile, BBError, BBStrRes;
  278.  
  279.  
  280.  
  281. const
  282.   cmProgressDlg_Add = 1000;
  283.   cmProgressDlg_Set = 1001;
  284.  
  285. type
  286.   PMyInputLine = ^TMyInputLine;
  287.   TMyInputLine = object(TXInputLine)
  288.     AllowedChars : string;        {* if empty all chars are allowed *}
  289.     constructor Init(var Bounds : TRect; AMaxLen : integer; AnAllowedChars : string);
  290.     procedure HandleEvent(var Event : TEvent);  virtual;
  291.   end;
  292.  
  293.   PPasswordInputLine = ^TPasswordInputLine;
  294.   TPasswordInputLine = object(TInputLine)
  295.     procedure Draw;  virtual;
  296.   end;
  297.  
  298.   PPercentBar = ^TPercentBar;
  299.   TPercentBar = object(TView)
  300.     constructor Init(Bounds: TRect);
  301.     procedure Draw; virtual;
  302.     function GetPalette: PPalette; virtual;
  303.     procedure Update(APercent : word);
  304.     function Valid(Command: Word): Boolean; virtual;
  305.   private
  306.     Percent: Integer;
  307.   end;
  308.  
  309.   PProgressDlg = ^TProgressDlg;
  310.   TProgressDlg = object(TDialog)
  311.     Percent : integer;       {* 0..100% *}
  312.     Total : longint;
  313.     PercDisplay : PStaticText;
  314.     PercentBar : PPercentBar;
  315.     TextDisplay : PStaticText;
  316.     constructor Init(var Bounds : TRect; ATitle : TTitleStr; ATotal : longint);
  317.     procedure SetPerc(Position : longint);
  318.     procedure NewText(const s : string);
  319.   private
  320.     LastPosition : longint;
  321.     Limit : longint;
  322.   end;
  323.  
  324. const
  325.   ProgressDlg:PProgressDlg = nil;
  326.  
  327.  
  328.  
  329. procedure DisposeSItem(PS : PSItem);
  330. { PRE - PS = nil or not nil }
  331. begin
  332.   if PS <> nil then  begin
  333.     DisposeSItem(PS^.next);
  334.     DisposeStr(PS^.value);
  335.     Dispose(PS);
  336.   end;
  337. end;
  338.  
  339.  
  340. function MessageBox(const Msg : string; Params: pointer; AOptions: word;
  341.   AHelpCtx : word): word;
  342. var
  343.   R: TRect;
  344. begin
  345.   R.Assign(0, 0, 40, 9);
  346.   R.Move((Desktop^.Size.X - R.B.X) div 2, (Desktop^.Size.Y - R.B.Y) div 2);
  347.   MessageBox := MessageBoxRect(R, Msg, Params, AOptions, AHelpCtx);
  348. end;
  349.  
  350.  
  351. procedure InsertButtons(Dialog : PDialog; AOptions : word);
  352. {* inserts language specific buttons in any dialog *}
  353. const
  354.   ButtonName: array[0..4] of string[6] =
  355.     ('~Y~es', '~N~o', 'O~K~', 'Cancel', 'Help');
  356. const
  357.   Commands: array[0..4] of word =
  358.     (cmYes, cmNo, cmOK, cmCancel, cmHelp);
  359. var
  360.   I, X, ButtonCount: Integer;
  361.   Control: PView;
  362.   R : TRect;
  363.   ButtonList: array[0..4] of PView;
  364. begin
  365.   with Dialog^ do  begin
  366.     X := -2;
  367.     ButtonCount := 0;
  368.     for I := 0 to 4 do
  369.       if AOptions and ($0100 shl I) <> 0 then  begin
  370.         R.Assign(0, 0, 10, 2);
  371.         if I in [0, 2]
  372.          then  begin
  373.            if Strings = nil
  374.             then  Control := New(PButton, Init(R, ButtonName[I], Commands[i], bfDefault))
  375.             else  begin
  376.               if rsGet(sButtonYes+I) = ''
  377.                then  Control := New(PButton, Init(R, ButtonName[I], Commands[i], bfDefault))
  378.                else  Control := New(PButton, Init(R, rsGet(sButtonYes+I), Commands[i],bfDefault));
  379.             end;
  380.          end
  381.          else  begin
  382.            if Strings = nil
  383.             then  Control := New(PButton, Init(R, ButtonName[I], Commands[i], bfNormal))
  384.             else  begin
  385.               if rsGet(sButtonYes+I) = ''
  386.                then  Control := New(PButton, Init(R, ButtonName[I], Commands[i], bfNormal))
  387.                else  Control := New(PButton, Init(R, rsGet(sButtonYes+I), Commands[i], bfNormal));
  388.             end;
  389.          end;
  390.         Inc(X, Control^.Size.X + 2);
  391.         ButtonList[ButtonCount] := Control;
  392.         Inc(ButtonCount);
  393.       end;
  394.     X := (Size.X - X) shr 1;
  395.     for I := 0 to ButtonCount - 1 do  begin
  396.       Control := ButtonList[I];
  397.       Insert(Control);
  398.       Control^.MoveTo(X, Size.Y - 3);
  399.       Inc(X, Control^.Size.X + 2);
  400.     end;  { of for }
  401.     SelectNext(FALSE);
  402.   end;  { of with }
  403. end;
  404.  
  405.  
  406. function MessageBoxRect(var R: TRect; const Msg: string; Params: pointer;
  407.   AOptions: word; AHelpCtx : word): word;
  408. const
  409.   Titles: array[0..3] of string[11] =
  410.     ('Warning','Error','Information','Confirm');
  411. var
  412.   Dialog: PDialog;
  413.   Control: PView;
  414.   S: String;
  415. begin
  416.   if Strings = nil
  417.    then
  418.      Dialog := New(PDialog,
  419.       Init(R, Titles[AOptions and $3]))
  420.    else
  421.      Dialog := New(PDialog,
  422.       Init(R, rsGet(sWarning + (AOptions and $3))));
  423.   with Dialog^ do  begin
  424.     R.Assign(3, 2, Size.X - 2, Size.Y - 3);
  425.     FormatStr(S, Msg, Params^);
  426.     Control := New(PStaticText, Init(R, S));
  427.     Insert(Control);
  428.     InsertButtons(Dialog, AOptions);
  429.   end; { of with }
  430.   Dialog^.HelpCtx := AHelpCtx;
  431.   MessageBoxRect := DeskTop^.ExecView(Dialog);
  432.   Dispose(Dialog, Done);
  433. end;
  434.  
  435.  
  436. procedure PrintError(const s : string; AHelpCtx : word);
  437. var
  438.   StackFrame : word;
  439. begin
  440.   asm
  441.     mov StackFrame,bp
  442.   end;
  443.   if Application = nil
  444.    then  BBGui.TextPrintError(s, AHelpCtx)
  445.    else  begin
  446.      Beep;
  447.      LogError('Error: ' + s);
  448.      MessageBox(s, nil, mfError + mfOKButton, AHelpCtx);
  449.      if @DumpStack <> nil then  DumpStack(nil, StackFrame);
  450.    end;
  451. end;
  452.  
  453.  
  454. procedure PrintWarning(const s : string; AHelpCtx : word);
  455. begin
  456.   if Application = nil
  457.    then  BBGui.TextPrintError(s, AHelpCtx)
  458.    else  begin
  459.      Beep;
  460.      MessageBox(s, nil, mfWarning + mfOKButton, AHelpCtx);
  461.      LogError('Warning: ' + s);
  462.    end;
  463. end;
  464.  
  465.  
  466. function PromptUser(const s : string; AHelpCtx : word) : word;
  467. begin
  468.   if Application = nil
  469.    then  begin
  470.      writeln(s);
  471.      PromptUser := cmYes;
  472.    end
  473.    else
  474.      PromptUser := MessageBox(s, nil, mfInformation + mfOKButton, AHelpCtx);
  475. end;
  476.  
  477. function UserAnswer(const s : string; AHelpCtx : word) : word;
  478. begin
  479.   if Application = nil
  480.    then  UserAnswer := TextUserAnswer(s, AHelpCtx)
  481.    else  UserAnswer := MessageBox(s, nil, mfConfirmation + mfYesNoCancel, AHelpCtx);
  482. end;
  483.  
  484. function popAnswer(const s : string; AHelpCtx : word) : word;
  485. begin
  486.   popAnswer := UserAnswer(s, AHelpCtx);
  487. end;
  488.  
  489. constructor TMyInputLine.Init (var Bounds : TRect; AMaxLen : integer; AnAllowedChars : string);
  490. begin
  491.   inherited Init(Bounds, AMaxLen);
  492.   AllowedChars := AnAllowedChars;
  493. end;
  494.  
  495. procedure TMyInputLine.HandleEvent (var Event : TEvent);
  496. begin
  497.   if (AllowedChars <> '') and (Event.What and evKeyBoard <> 0) and
  498.      (Event.CharCode in [#32..#255]) then  begin
  499.     if Pos(Event.CharCode, AllowedChars) = 0 then  begin
  500.       Event.CharCode := UpCase(Event.CharCode);
  501.       if Pos(Event.CharCode, AllowedChars) = 0 then  begin
  502.         ClearEvent(Event);
  503.         Beep;
  504.       end;
  505.     end;
  506.   end;
  507.   inherited HandleEvent(Event);
  508. end;
  509.  
  510. function InputString(Header : string; var s : string; len : word;
  511.   AllowedChars : string; AHelpCtx : word) : word;
  512. var
  513.   R: TRect;
  514.   Dialog : PDialog;
  515. begin
  516.   R.Assign(0, 0, 40, 7);
  517.   R.Move((Desktop^.Size.X - R.B.X) div 2, (Desktop^.Size.Y - R.B.Y) div 2);
  518.   Dialog := New(PDialog, Init(R, Header));
  519.   Dialog^.HelpCtx := AHelpCtx;
  520.   if len < Dialog^.Size.X-1
  521.    then  R.Assign(2,2, 2+2+len,3)
  522.    else  R.Assign(2,2, Dialog^.Size.X-2, 3);
  523.   Dialog^.Insert(New(PMyInputLine, Init(R, len, AllowedChars)));
  524.   InsertButtons(Dialog, mfOKCancelHelp);
  525.   InputString := ExecDialog(Dialog, @s);
  526. end;
  527.  
  528. function InputWord(Header : string; var w : word; len : word; AHelpCtx : word) : word;
  529. var
  530.   s : string;
  531. begin
  532.   s := '';
  533.   InputWord := InputString(Header, s, len, Numbers, AHelpCtx);
  534.   w := ValW(s);
  535. end;
  536.  
  537. procedure InfoBox(const s : string; AHelpCtx : word);
  538. begin
  539.   if Application = nil
  540.    then  BBGui.TextInfoBox(s, AHelpCtx)
  541.    else  MessageBox(s, nil, mfInformation + mfOKButton, AHelpCtx);
  542. end;
  543.  
  544. function ExecDialog(P : PDialog; Data : pointer): word;
  545. var
  546.   Result: Word;
  547. begin
  548.   Result := cmCancel;
  549.   P := PDialog(Application^.ValidView(P));
  550.   if P <> nil then
  551.   begin
  552.     if Data <> nil then P^.SetData(Data^);
  553.     Result := DeskTop^.ExecView(P);
  554.     if (Result <> cmCancel) and (Data <> nil) then P^.GetData(Data^);
  555.     Dispose(P, Done);
  556.   end;
  557.   ExecDialog := Result;
  558. end;
  559.  
  560.  
  561. function CheckExecDialog(P : PDialog; Data: pointer; DataSize : word): word;
  562. var
  563.   Result: Word;
  564. begin
  565.   Result := cmCancel;
  566.   P := PDialog(Application^.ValidView(P));
  567.   if P <> nil then
  568.   begin
  569.     if Data <> nil then begin
  570.       if P^.DataSize <> DataSize then  begin
  571.         PrintError('Internal error. DataSize mismatch -- CheckExecDialog --', hcNoContext);
  572.         Halt(1);
  573.       end;
  574.       P^.SetData(Data^);
  575.     end;
  576.     Result := DeskTop^.ExecView(P);
  577.     if (Result <> cmCancel) and (Data <> nil) then P^.GetData(Data^);
  578.     Dispose(P, Done);
  579.   end;
  580.   CheckExecDialog := Result;
  581. end;
  582.  
  583.  
  584.  
  585. procedure TPasswordInputLine.Draw;
  586. var
  587.   s : string;
  588.   i : integer;
  589. begin
  590.   s := Data^;
  591.   for i := 1 to length(s) do  Data^[i] := '*';
  592.   inherited Draw;
  593.   Data^ := s;
  594. end;
  595.  
  596. function PassWord(const s : string; AHelpCtx : word) : Boolean;
  597. var
  598.   R : TRect;
  599.   Dialog : PDialog;
  600.   es : string;
  601.   p : PPalette;
  602.   sc1,sc2 : char;
  603. begin
  604.   R.Assign(0, 0, 40, 9);
  605.   R.Move((Desktop^.Size.X - R.B.X) div 2, (Desktop^.Size.Y - R.B.Y) div 2);
  606.   Dialog := New(PDialog, Init(R, rsGet(sPassword)));
  607.   Dialog^.HelpCtx := AHelpCtx;
  608.   R.Assign(2,2, 39,3);
  609.   Dialog^.Insert(New(PStaticText, Init(R, rsGet(sEnterPassword))));
  610.   R.Assign(4,4, 4+16+2,5);
  611.   Dialog^.Insert(New(PPasswordInputLine, Init(R, PassWordLen)));
  612.   InsertButtons(Dialog, mfOKCancel);
  613.   PButton(Dialog^.Current^.Prev)^.AmDefault := TRUE;
  614.   if DeskTop^.ExecView(Dialog) = cmCancel
  615.    then  PassWord := FALSE
  616.    else  begin
  617.      Dialog^.GetData(es);
  618.      if UpStr(es) = UpStr(s)
  619.       then  PassWord := TRUE
  620.       else  PassWord := FALSE;
  621.    end;
  622. end;
  623.  
  624.  
  625.  
  626. {---------------------------------------------------------------------------}
  627. {* TProgressDlg                                                            *}
  628. {---------------------------------------------------------------------------}
  629.  
  630. constructor TPercentBar.Init(Bounds: TRect);
  631. begin
  632.   inherited Init(Bounds);
  633.   Percent := 0;
  634. end;
  635.  
  636. procedure TPercentBar.Draw;
  637. var
  638.   Color : byte;
  639.   i : integer;
  640.   B : TDrawBuffer;
  641.   Temp : string;
  642.   PerSize : integer;
  643. begin
  644.   if Percent = 100
  645.    then  PerSize := Size.X
  646.    else  PerSize := (longint(Percent)*Size.X) div 100;
  647.  
  648.   Temp := RepChar(#177, Size.X);
  649.  
  650.   for i := 1 to Size.X do  begin
  651.     if i <= PerSize
  652.      then  Color := GetColor(2)   { use #20 for completed }
  653.      else Color := GetColor(1);   { and #19 for incomplete 'area' of bar }
  654.  
  655.     MoveChar(B[i-1], Temp[i], Color, 1); { copy temp str into buffer }
  656.   end;  { of for i }
  657.  
  658.   WriteBuf(0, 0, Size.X, 1, B);   { write buffer into view }
  659. end;
  660.  
  661. function TPercentBar.GetPalette: PPalette;
  662. const P:string[2] = #19#20;
  663. begin
  664.   GetPalette := @P;
  665. end;
  666.  
  667. procedure TPercentBar.Update(APercent : word);
  668. begin
  669.   Percent := APercent;
  670.   DrawView;
  671. end;
  672.  
  673. function TPercentBar.Valid(Command: Word): Boolean;
  674. begin
  675.   if Command = cmValid
  676.    then  Valid := (Size.X >= 10) and (Size.Y = 1)
  677.    else  Valid := inherited Valid(Command);
  678. end;
  679.  
  680.  
  681. constructor TProgressDlg.Init(var Bounds : TRect; ATitle : TTitleStr; ATotal : longint);
  682. var
  683.   R : TRect;
  684. begin
  685.   inherited Init(Bounds, ATitle);
  686.   if ATotal = 0
  687.    then  Total := 1
  688.    else  Total := ATotal;
  689.   Limit := Round(0.025 * Total);
  690.   R.Assign(Size.X-4-4,3, Size.X-4,4);
  691.   Percent := 0;
  692.   PercDisplay := New(PStaticText, Init(R, '  0%'));
  693.   Insert(PercDisplay);
  694.   R.Assign(4,4, Size.X-4,5);
  695.   PercentBar := New(PPercentBar, Init(R));
  696.   Insert(PercentBar);
  697.   R.Assign(3,2, Size.X-3,3);
  698.   TextDisplay := New(PstaticText, Init(r, ''));
  699. end;
  700.  
  701. procedure TProgressDlg.SetPerc(Position : longint);
  702. begin
  703.   if (Position - LastPosition) < Limit then  Exit;
  704.   LastPosition := Position;
  705.   Lock;
  706.   FreeStr(PercDisplay^.Text);
  707.   if Position >= Total
  708.    then  begin
  709.      PercDisplay^.Text := NewStr('100%');
  710.      Percent := 100;
  711.    end
  712.    else  begin
  713.      PercDisplay^.Text := NewStr(' '+StrW(Percent)+'%');
  714.      Percent := (Position*100) div Total;
  715.    end;
  716.   PercentBar^.Update(Percent);
  717.   Redraw;
  718.   Unlock;
  719. end;
  720.  
  721. procedure TProgressDlg.NewText(const s : string);
  722. begin
  723.   FreeStr(TextDisplay^.Text);
  724.   TextDisplay^.Text := NewStr(s);
  725.   TextDisplay^.Draw;
  726. end;
  727.  
  728.  
  729. procedure OpenProgressDlg(const ATitle : string; ATotal : longint);
  730. var
  731.   R : TRect;
  732. begin
  733.   if Application = nil
  734.    then  TextOpenProgressDlg(ATitle, ATotal)
  735.    else  begin
  736.      R.Assign(0, 0, 40, 8);
  737.      R.Move((Desktop^.Size.X - R.B.X) div 2, (Desktop^.Size.Y - R.B.Y) div 2);
  738.      ProgressDlg := New(PProgressDlg, Init(R, ATitle, ATotal));
  739.      DeskTop^.Insert(ProgressDlg);
  740.    end;
  741. end;
  742.  
  743. procedure CloseProgressDlg;
  744. begin
  745.   if Application = nil
  746.    then  TextCloseProgressDlg
  747.    else  begin
  748.      if ProgressDlg <> nil then  begin
  749.        DeskTop^.Delete(ProgressDlg);
  750.        Discard(ProgressDlg);
  751.      end;
  752.    end;
  753. end;
  754.  
  755. procedure SetProgressDlg(Position : longint);
  756. begin
  757.   if Application = nil
  758.    then  TextSetProgressDlg(Position)
  759.    else  begin
  760.      if ProgressDlg <> nil then
  761.        ProgressDlg^.SetPerc(Position);
  762.    end;
  763. end;
  764.  
  765. procedure ProgressDlgNewText(const s : string);
  766. begin
  767.   if ProgressDlg <> nil then
  768.     ProgressDlg^.NewText(s);
  769. end;
  770.  
  771.  
  772. {---------------------------------------------------------------------------}
  773. {* ShowHelpWindow                                                          *}
  774. {---------------------------------------------------------------------------}
  775.  
  776. procedure ShowHelpWindow(const FileName : string; HelpCtx : word);
  777. var
  778.   W : PWindow;
  779.   HFile : PHelpFile;
  780.   HelpStrm : PBufStream;
  781. begin
  782.   HelpStrm := New(PBufStream, Init(FileName, stOpenRead, 1024));
  783.   HFile := New(PHelpFile, Init(HelpStrm));
  784.   if HelpStrm^.Status = stOk
  785.    then  begin
  786.       W := New(PHelpWindow,Init(HFile, HelpCtx));
  787.       if Application^.ValidView(W) <> nil then  begin
  788.         Application^.ExecView(W);
  789.         Dispose(W, Done);
  790.       end;
  791.    end
  792.    else  begin
  793.      PrintError(rsGet1(word(HelpStrm^.Status), longint(@FileName)), hcNoContext);
  794.      Dispose(HFile, Done);
  795.    end;
  796. end;
  797.  
  798.  
  799. {---------------------------------------------------------------------------}
  800. {* ViewAsText                                                              *}
  801. {---------------------------------------------------------------------------}
  802.  
  803. procedure ViewAsText(const FileName : FNameStr);
  804. {* copied from /bp/examples/dos/tvfm/tools.pas *}
  805. var
  806.   T : PTextWindow;
  807.   R : TRect;
  808. begin
  809.   R.Assign(0,0,72,15);
  810.   T := New(PTextWindow, Init(R, FileName));
  811.   T^.Options := T^.Options or ofCentered;
  812.   Desktop^.Insert(T);
  813. end;
  814.  
  815.  
  816. {---------------------------------------------------------------------------}
  817. {* TPopUpMenuBox                                                           *}
  818. {---------------------------------------------------------------------------}
  819.  
  820. destructor TPopupMenu.Done;
  821. { This destructor has to be defined, because TMenuPopup.Done won't dispose the
  822.   menulist
  823. }
  824. begin
  825.   DisposeMenu(Menu);
  826.   inherited Done;
  827. end;
  828.  
  829.  
  830. {---------------------------------------------------------------------------}
  831. {* TSpinButton                                                             *}
  832. {---------------------------------------------------------------------------}
  833.  
  834. constructor TSpinButton.Init(var Bounds : TRect; AStrings : PSItem);
  835. begin
  836.   inherited Init(Bounds, AStrings);
  837.   SetCursor(1,0);
  838. end;
  839.  
  840. procedure TSpinButton.Draw;
  841. var
  842.   Buf : TDrawBuffer;
  843.   Attrs : word;
  844. begin
  845.   if GetState(sfSelected)
  846.    then  Attrs := GetColor($0402)
  847.    else  Attrs := GetColor($0301);
  848.   MoveChar(Buf, ' ', Lo(Attrs), Size.X);
  849.   if Sel < Strings.Count then
  850.     MoveCStr(Buf, #17 + LeftJustify(PString(Strings.At(Sel))^, Size.X)+#16, Attrs);
  851.   WriteBuf(0,0, Size.X, Size.Y, Buf);
  852. end;
  853.  
  854. procedure TSpinButton.HandleEvent(var Event : TEvent);
  855.  
  856.   procedure HandleMouse;
  857.   var
  858.     MouseLoc : TPoint;
  859.   begin
  860.     if (Event.What and (evMouseDown+evMouseAuto) <> 0) then  begin
  861.       repeat
  862.         MakeLocal(Event.Where, MouseLoc);
  863.         if MouseLoc.X = 0
  864.          then  begin
  865.            if Sel = 0
  866.             then  Sel := Strings.Count-1
  867.             else  Dec(Sel);
  868.          end
  869.          else
  870.            if MouseLoc.X = Size.X-1
  871.             then  begin
  872.               if Sel = Strings.Count-1
  873.                then  Sel := 0
  874.                else  Inc(Sel);
  875.             end
  876.             else  begin
  877.               ClearEvent(Event);
  878.               Exit;
  879.             end;
  880.         MovedTo(Sel);
  881.         DrawView;
  882.       until not MouseEvent(Event, evMouseAuto); {Wait for mouse up}
  883.       ClearEvent(Event);
  884.     end;
  885.   end;
  886.  
  887. begin
  888.   TView.HandleEvent(Event);
  889.   HandleMouse;
  890.   inherited HandleEvent(Event);
  891. end;
  892.  
  893.  
  894. {---------------------------------------------------------------------------}
  895. {* TXInputLine                                                             *}
  896. {---------------------------------------------------------------------------}
  897.  
  898. procedure TXInputLine.HandleEvent (var Event : TEvent);
  899.  
  900.   procedure ClipPaste(var Buf : PEditBuffer;
  901.                       Offset, Length : word);
  902.   var
  903.     rec : string;
  904.   begin
  905.      rec := '';
  906.      {--- Check to make sure we don't exceed field length ---}
  907.      if Length > MaxLen then
  908.        Length := MaxLen;
  909.  
  910.      {--- Copy contents of clipboard to input line ---}
  911.      Move(Buf^[Offset], Rec[1], Length);
  912.  
  913.      {--- Set the length of the string ---}
  914.      Rec[0] := Char(Length);
  915.  
  916.      {--- Set the data in the dialog ---}
  917.      SetData(rec);
  918.   end;
  919.  
  920.   procedure ClipCopy;
  921.   var
  922.     s : string;
  923.   begin
  924.      GetData(s);
  925.      s := FTCopy(s, SelStart+1, SelEnd);
  926.      ClipBoard^.InsertText(@s[1], length(s), TRUE);
  927.   end;
  928.  
  929. const
  930.   Boundary = '!@#$%^&*()-+=[]{};''`:"~\ ,./|<>?';
  931. var
  932.   s : string;
  933. begin
  934.   inherited HandleEvent(Event);
  935.   case Event.What of
  936.     evKeyBoard : begin
  937.         case Event.KeyCode of
  938.           kbCtrlLeft : begin
  939.               if SelStart <> SelEnd then  SelectAll(FALSE);
  940.               GetData(s);
  941.  
  942.             {* go left if on boundary *}
  943.               while (CurPos > 0) and (Pos(s[CurPos], Boundary) <> 0) do  Dec(CurPos);
  944.  
  945.             {* go left, until boundary is found or edge is reached *}
  946.               while (CurPos > 0) and (Pos(s[CurPos], Boundary) = 0) do  Dec(CurPos);
  947.  
  948.               if CurPos < FirstPos then
  949.                 Dec(FirstPos, FirstPos - CurPos);
  950.               DrawView;
  951.             end;
  952.           kbCtrlRight : begin
  953.               if SelStart <> SelEnd then  SelectAll(FALSE);
  954.               GetData(s);
  955.  
  956.             {* go right, until boundary is found or edge is reached *}
  957.               while (CurPos < length(s)) and (Pos(s[CurPos+1], Boundary) = 0) do  Inc(CurPos);
  958.  
  959.             {* go right if current character is a boundary *}
  960.               while (CurPos < length(s)) and (Pos(s[CurPos+1], Boundary) <> 0) do  Inc(CurPos);
  961.  
  962.               if CurPos > FirstPos + Size.X-2 then
  963.                 Inc(FirstPos, CurPos - (Size.X - 2));
  964.               DrawView;
  965.             end;
  966.           kbShiftIns : begin
  967.               with ClipBoard^ do
  968.                 ClipPaste(Buffer, BufPtr(SelStart), SelEnd - SelStart);
  969.             end;
  970.           kbCtrlIns : ClipCopy;
  971.         else  Exit;
  972.         end;  { of case }
  973.         ClearEvent(Event);
  974.       end;
  975.     evCommand : begin
  976.         case Event.Command of
  977.           cmPaste : with ClipBoard^ do
  978.                       ClipPaste(Buffer, BufPtr(SelStart), SelEnd - SelStart);
  979.           cmCopy : ClipCopy;
  980.         else  Exit;
  981.         end; { of case }
  982.         ClearEvent(Event);
  983.       end;
  984.   end; { of case }
  985. end;
  986.  
  987.  
  988. {---------------------------------------------------------------------------}
  989. {* TListViewer2 and TListBox2                                              *}
  990. {---------------------------------------------------------------------------}
  991.  
  992. constructor TListViewer2.Init(var Bounds: TRect; ANumCols: Integer;
  993.   AHScrollBar, AVScrollBar: PScrollBar);
  994. begin
  995.   inherited Init(Bounds, ANumCols, AHScrollBar, AVScrollBar);
  996.   Options := Options or ofPostProcess;
  997.   TypedStr := NewStr(Spc(Size.X div NumCols + 1));
  998. end;
  999.  
  1000. procedure TListViewer2.HandleEvent(var Event : TEvent);
  1001. var
  1002.   ColWidth : word;
  1003.   i : integer;
  1004.   P : TPoint;
  1005. begin
  1006.   i := Focused;
  1007.   if RightMouseButtonIsEdit and
  1008.      (Event.What and (evMouseDown+evMouseUp) <> 0) and (Event.Buttons = mbRightButton)
  1009.    then  begin
  1010.      if Event.What = evMouseDown then  begin
  1011.        MakeLocal(Event.Where, P);
  1012.        inherited HandleEvent(Event);
  1013.        if P.Y < Range-TopItem then
  1014.          EditItem;
  1015.      end;
  1016.    end
  1017.    else
  1018.      inherited HandleEvent(Event);
  1019.   if Focused <> i then
  1020.     TypedStrIndex := 0;
  1021.   case Event.What of
  1022.     evCommand : begin
  1023.         case Event.Command of
  1024.           cmInsertItem, cmBInsertItem : InsertItem;
  1025.           cmDeleteItem, cmBDeleteItem : if Focused < Range then  DeleteItem;
  1026.           cmEditItem, cmBEditItem : if Focused < Range then  EditItem;
  1027.         else  Exit;
  1028.         end;  { of case }
  1029.       end;
  1030.     evBroadCast : begin
  1031.         case Event.Command of
  1032.           cmReceivedFocus : if Event.InfoPtr = @Self then
  1033.                               EnableCommands([cmInsertItem, cmDeleteItem]);
  1034.           cmReleasedFocus : if Event.InfoPtr = @Self then
  1035.                               DisableCommands([cmInsertItem, cmDeleteItem]);
  1036.         else  Exit;
  1037.         end; { of case }
  1038.       end;
  1039.     evKeyboard : begin
  1040.         ColWidth := Size.X div NumCols + 1;
  1041.         if (Event.CharCode in [#32..#255]) and (TypedStrIndex < ColWidth)
  1042.          then  begin
  1043.            Inc(TypedStrIndex);
  1044.            TypedStr^[TypedStrIndex] := UpCase(Event.CharCode);
  1045.            TypedStr^[0] := Chr(TypedStrIndex);
  1046.            for i := 0 to Range-1 do  begin
  1047.              if UpStr(Copy(GetText(i, ColWidth), 1, TypedStrIndex)) = TypedStr^ then  begin
  1048.                inherited FocusItem(i);
  1049.                break;
  1050.              end;
  1051.            end;
  1052.          end
  1053.          else  begin
  1054.            case Event.KeyCode of
  1055.              kbDel, kbBack : if TypedStrIndex > 0 then  Dec(TypedStrIndex);
  1056.            else  Exit;
  1057.            end; { of case }
  1058.          end;
  1059.       end;
  1060.   else  Exit;
  1061.   end; { of case }
  1062.   if Event.What and evBroadCast = 0 then  ClearEvent(Event);
  1063. end;
  1064.  
  1065. procedure TListViewer2.InsertItem;
  1066. begin
  1067.   Abstract;
  1068. end;
  1069.  
  1070. procedure TListViewer2.DeleteItem;
  1071. begin
  1072.   Abstract;
  1073. end;
  1074.  
  1075. procedure TListViewer2.EditItem;
  1076. begin
  1077.   Abstract;
  1078. end;
  1079.  
  1080.  
  1081. constructor TListBox2.Init(var Bounds: TRect; ANumCols: Integer; AVScrollBar: PScrollBar);
  1082. begin
  1083.   inherited Init(Bounds, ANumCols, AVScrollBar);
  1084.   Options := Options or ofPostProcess;
  1085.   TypedStr := NewStr(Spc(Size.X div NumCols + 1));
  1086. end;
  1087.  
  1088. procedure TListbox2.HandleEvent(var Event : TEvent);
  1089. var
  1090.   ColWidth : word;
  1091.   i : integer;
  1092.   P : TPoint;
  1093. begin
  1094.   i := Focused;
  1095.   if RightMouseButtonIsEdit and
  1096.      (Event.What and (evMouseDown+evMouseUp) <> 0) and (Event.Buttons = mbRightButton)
  1097.    then  begin
  1098.      if Event.What = evMouseDown then  begin
  1099.        MakeLocal(Event.Where, P);
  1100.        inherited HandleEvent(Event);
  1101.        if P.Y < Range-TopItem then
  1102.          EditItem;
  1103.      end;
  1104.    end
  1105.    else
  1106.      inherited HandleEvent(Event);
  1107.   if Focused <> i then
  1108.     TypedStrIndex := 0;
  1109.   case Event.What of
  1110.     evCommand : begin
  1111.         case Event.Command of
  1112.           cmInsertItem, cmBInsertItem : begin
  1113.               if (List^.Count < List^.Limit) or (List^.Delta > 0) then
  1114.                 InsertItem;
  1115.             end;
  1116.           cmDeleteItem, cmBDeleteItem : if Focused < Range then  DeleteItem;
  1117.           cmEditItem, cmBEditItem : if Focused < Range then  EditItem;
  1118.         else  Exit;
  1119.         end;  { of case }
  1120.       end;
  1121.     evBroadCast : begin
  1122.         case Event.Command of
  1123.           cmReceivedFocus : if Event.InfoPtr = @Self then
  1124.                               EnableCommands([cmInsertItem, cmDeleteItem]);
  1125.           cmReleasedFocus : if Event.InfoPtr = @Self then
  1126.                               DisableCommands([cmInsertItem, cmDeleteItem]);
  1127.         else  Exit;
  1128.         end; { of case }
  1129.       end;
  1130.     evKeyboard : begin
  1131.         ColWidth := Size.X div NumCols + 1;
  1132.         if (Event.CharCode in [#32..#255]) and (TypedStrIndex < ColWidth)
  1133.          then  begin
  1134.            Inc(TypedStrIndex);
  1135.            TypedStr^[TypedStrIndex] := UpCase(Event.CharCode);
  1136.            TypedStr^[0] := Chr(TypedStrIndex);
  1137.            for i := 0 to Range-1 do  begin
  1138.              if UpStr(Copy(GetText(i, ColWidth), 1, TypedStrIndex)) = TypedStr^ then  begin
  1139.                inherited FocusItem(i);
  1140.                break;
  1141.              end;
  1142.            end;
  1143.          end
  1144.          else  begin
  1145.            case Event.KeyCode of
  1146.              kbDel, kbBack : if TypedStrIndex > 0 then  Dec(TypedStrIndex);
  1147.            else  Exit;
  1148.            end; { of case }
  1149.          end;
  1150.       end;
  1151.   else  Exit;
  1152.   end; { of case }
  1153.   if Event.What and evBroadCast = 0 then  ClearEvent(Event);
  1154. end;
  1155.  
  1156. procedure TListbox2.InsertItem;
  1157. begin
  1158.   Abstract;
  1159. end;
  1160.  
  1161. procedure TListbox2.DeleteItem;
  1162. begin
  1163.   Abstract;
  1164. end;
  1165.  
  1166. procedure TListbox2.EditItem;
  1167. begin
  1168.   Abstract;
  1169. end;
  1170.  
  1171.  
  1172. {---------------------------------------------------------------------------}
  1173. {* TParamInputBox                                                          *}
  1174. {---------------------------------------------------------------------------}
  1175.  
  1176. procedure TParamInputBox.InsertItem;
  1177. var
  1178.   s : string;
  1179. begin
  1180.   s := '';
  1181.   if InputString('Parameter', s, 255, '', hcNoContext) = cmOK then  begin
  1182.     List^.AtInsert(Focused, NewStr(s));
  1183.     SetRange(Range+1);
  1184.     Inc(Focused);
  1185.     DrawView;
  1186.   end;
  1187. end;
  1188.  
  1189. procedure TParamInputBox.DeleteItem;
  1190. var
  1191.   s : string;
  1192. begin
  1193.   if Focused >= Range-1 then  Exit;
  1194.   if UserAnswer('Delete current item?', hcNoContext) = Yes then  begin
  1195.     List^.AtFree(Focused);
  1196.     SetRange(Range-1);
  1197.     DrawView;
  1198.   end;
  1199. end;
  1200.  
  1201. procedure TParamInputBox.EditItem;
  1202. var
  1203.   s : string;
  1204. begin
  1205.   if Focused >= Range-1 then  Exit;
  1206.   s := GetStr(PString(List^.At(Focused)));
  1207.   if InputString('Parameter', s, 255, '', hcNoContext) = cmOK then  begin
  1208.     List^.FreeItem(List^.At(Focused));
  1209.     List^.AtPut(Focused, NewStr(s));
  1210.     DrawView;
  1211.   end;
  1212. end;
  1213.  
  1214.  
  1215. {---------------------------------------------------------------------------}
  1216. {* TStringInputBox                                                         *}
  1217. {---------------------------------------------------------------------------}
  1218.  
  1219. procedure TStringInputBox.InsertItem;
  1220. var
  1221.   s : string;
  1222. begin
  1223.   s := '';
  1224.   if InputString('Parameter', s, 255, '', hcNoContext) = cmOK then  begin
  1225.     List^.Insert(NewStr(s));
  1226.     SetRange(Range+1);
  1227.     Inc(Focused);
  1228.     DrawView;
  1229.   end;
  1230. end;
  1231.  
  1232. procedure TStringInputBox.DeleteItem;
  1233. var
  1234.   s : string;
  1235. begin
  1236.   if UserAnswer('Delete current item?', hcNoContext) = Yes then  begin
  1237.     List^.AtFree(Focused);
  1238.     SetRange(Range-1);
  1239.     DrawView;
  1240.   end;
  1241. end;
  1242.  
  1243. procedure TStringInputBox.EditItem;
  1244. var
  1245.   s : string;
  1246. begin
  1247.   s := GetStr(PString(List^.At(Focused)));
  1248.   if InputString('Parameter', s, 255, '', hcNoContext) = cmOK then  begin
  1249.     List^.FreeItem(List^.At(Focused));
  1250.     List^.Insert(NewStr(s));
  1251.     DrawView;
  1252.   end;
  1253. end;
  1254.  
  1255.  
  1256. {---------------------------------------------------------------------------}
  1257. {* RegisterBBDlg                                                           *}
  1258. {---------------------------------------------------------------------------}
  1259.  
  1260. procedure RegisterBBDlg;
  1261. begin
  1262.   RegisterType(RPopupMenu);
  1263.   RegisterType(RSpinButton);
  1264.   RegisterType(RXInputLine);
  1265.   RegisterType(RListViewer2);
  1266.   RegisterType(RListBox2);
  1267.   RegisterType(RParamInputBox);
  1268.   RegisterType(RStringInputBox);
  1269. end;
  1270.  
  1271.  
  1272. begin
  1273.   BBGui.CloseProgressDlg := CloseProgressDlg;
  1274.   BBGui.InfoBox := InfoBox;
  1275.   BBGui.OpenProgressDlg := OpenProgressDlg;
  1276.   BBGui.PrintError := PrintError;
  1277.   BBGui.SetProgressDlg := SetProgressDlg;
  1278.   BBGui.UserAnswer := UserAnswer;
  1279. end.  { of unit BBDlg }
  1280.