home *** CD-ROM | disk | FTP | other *** search
/ Computer Club Elmshorn Atari PD / CCE_PD.iso / pc / 0600 / CCE_0632.ZIP / CCE_0632 / GOBJ_111.ZIP / GOBJECTS.111 / SOURCE / BEISPIEL / BEISPL11.PAS < prev    next >
Pascal/Delphi Source File  |  1994-03-26  |  16KB  |  678 lines

  1. program Beispiel; {$X+} { Beispiel Nr.11 }
  2.  
  3. uses
  4.  
  5.     Gem,Objects,OTypes,OProcs,OWindows,OValidat,ODialogs;
  6.  
  7. const
  8.  
  9.     {$I beispiel.i}
  10.  
  11. type
  12.  
  13.     PBeispielWindow = ^TBeispielWindow;
  14.     PAttrDialog     = ^TAttrDialog;
  15.     PLineData       = ^TLineData;
  16.     PLinie          = ^TLinie;
  17.     PPunkt          = ^TPunkt;
  18.     PAbout          = ^TAbout;
  19.     PNew            = ^TNew;
  20.     POpen           = ^TOpen;
  21.     PSave           = ^TSave;
  22.     PSaveAs         = ^TSaveAs;
  23.     PInfo           = ^TInfo;
  24.     PAttrib         = ^TAttrib;
  25.  
  26.     TMyApplication = object(TApplication)
  27.         save  : PSave;
  28.         saveas: PSaveAs;
  29.         info  : PInfo;
  30.         procedure InitInstance; virtual;
  31.         procedure InitMainWindow; virtual;
  32.         { neue Methoden: }
  33.         procedure UpdateInfo; virtual;
  34.     end;
  35.  
  36.     TBeispielWindow = object(TWindow)
  37.         Veraendert: boolean;
  38.         Dicke,
  39.         Farbe,
  40.         Art: integer;
  41.         Pfad,
  42.         Datei     : string;
  43.         Zeichnung : PCollection;
  44.         constructor Init(AParent: PWindow; ATitle: string);
  45.         destructor Done; virtual;
  46.         procedure GetWindowClass(var AWndClass: TWndClass); virtual;
  47.         function GetClassName: string; virtual;
  48.         function GetStyle: integer; virtual;
  49.         function GetScroller: PScroller; virtual;
  50.         function CanClose: boolean; virtual;
  51.         procedure Paint(var PaintInfo: TPaintStruct); virtual;
  52.         procedure WMButton(mX,mY,BStat,KStat,Clicks: integer); virtual;
  53.         { neue Methoden: }
  54.         procedure SetAttr(Width,Color,Style: integer); virtual;
  55.         procedure CreateTitle; virtual;
  56.         procedure Speichern; virtual;
  57.     end;
  58.  
  59.     TAttrDialog = object(TDialog)
  60.         function OK: boolean; virtual;
  61.         function Help: boolean; virtual;
  62.     end;
  63.  
  64.     TLineData = record
  65.         Farben: array [0..7] of integer;
  66.         Stile : array [1..6] of integer;
  67.         Breite: string[5]
  68.     end;
  69.  
  70.     TLinie = object(TObject)
  71.         Punkte: PCollection;
  72.         Dicke,
  73.         Farbe,
  74.         Art   : integer;
  75.         constructor Init(Width,Color,Style: integer);
  76.         destructor Done; virtual;
  77.         procedure NeuerPunkt(AX,AY: integer); virtual;
  78.         procedure Zeichnen; virtual;
  79.         procedure Speichern; virtual;
  80.     end;
  81.  
  82.     TPunkt = object(TObject)
  83.         X,
  84.         Y: integer;
  85.         constructor Init(AX,AY: integer);
  86.     end;
  87.  
  88.     TAbout  = object(TKeyMenu)
  89.         procedure Work; virtual;
  90.     end;
  91.  
  92.     TNew    = object(TKeyMenu)
  93.         procedure Work; virtual;
  94.     end;
  95.  
  96.     TOpen   = object(TKeyMenu)
  97.         procedure Work; virtual;
  98.     end;
  99.  
  100.     TSave   = object(TKeyMenu)
  101.         procedure Work; virtual;
  102.     end;
  103.  
  104.     TSaveAs = object(TKeyMenu)
  105.         procedure Work; virtual;
  106.     end;
  107.  
  108.     TInfo   = object(TKeyMenu)
  109.         st1,
  110.         st2: PStatic;
  111.         procedure Work; virtual;
  112.         procedure BerechneWerte; virtual;
  113.     end;
  114.  
  115.     TAttrib = object(TKeyMenu)
  116.         LineData: TLineData;
  117.         procedure Work; virtual;
  118.     end;
  119.  
  120. var
  121.  
  122.     MyApp: TMyApplication;
  123.     f    : file of integer;
  124.  
  125.  
  126. procedure MyResource; external; {$L beispiel.o}
  127.  
  128.  
  129. procedure TMyApplication.InitInstance;
  130.  
  131.     begin
  132.         InitResource(@MyResource,nil);
  133.         LoadMenu(BSPMENU);
  134.         new(PAbout,Init(@self,K_CTRL,Ctrl_A,MABOUT,MTITLE1));
  135.         new(PNew,Init(@self,K_CTRL,Ctrl_N,MNEW,MTITLE2));
  136.         new(POpen,Init(@self,K_CTRL,Ctrl_O,MOPEN,MTITLE2));
  137.         save:=new(PSave,Init(@self,K_CTRL,Ctrl_S,MSAVE,MTITLE2));
  138.         saveas:=new(PSaveAs,Init(@self,K_CTRL,Ctrl_D,MSAVEAS,MTITLE2));
  139.         info:=new(PInfo,Init(@self,K_CTRL,Ctrl_I,MINFO,MTITLE3));
  140.         new(PAttrib,Init(@self,K_CTRL,Ctrl_T,MATTR,MTITLE3));
  141.         inherited InitInstance;
  142.         SetQuit(MQUIT,MTITLE2);
  143.         save^.Disable;
  144.         saveas^.Disable
  145.     end;
  146.  
  147.  
  148. procedure TMyApplication.InitMainWindow;
  149.  
  150.     begin
  151.         new(PBeispielWindow,Init(nil,'Beispiel  [unbenannt]'));
  152.         if (MainWindow=nil) or (ChkError<em_OK) then
  153.             Status:=em_InvalidMainWindow
  154.     end;
  155.  
  156.  
  157. procedure TMyApplication.UpdateInfo;
  158.  
  159.     begin
  160.         if info^.ADialog<>nil then
  161.             if info^.ADialog^.Attr.Status=ws_Open then
  162.                 info^.BerechneWerte
  163.     end;
  164.  
  165.  
  166. constructor TBeispielWindow.Init(AParent: PWindow; ATitle: string);
  167.  
  168.     begin
  169.         if not(inherited Init(AParent,ATitle)) then fail;
  170.         new(Zeichnung,Init(10,10));
  171.         Veraendert:=false;
  172.         SetAttr(3,Blue,LT_SOLID);
  173.         Datei:='';
  174.         Pfad:=''
  175.     end;
  176.  
  177.  
  178. destructor TBeispielWindow.Done;
  179.  
  180.     begin
  181.         dispose(Zeichnung,Done);
  182.         inherited Done
  183.     end;
  184.  
  185.  
  186. function TBeispielWindow.CanClose: boolean;
  187.     var valid: boolean;
  188.  
  189.     begin
  190.         valid:=inherited CanClose;
  191.         if valid and Veraendert then
  192.             valid:=(Application^.Alert(@self,1,WAIT,
  193.                 ' Die Grafik wurde verändert!| Wollen Sie sie speichern?',
  194.               '&Ja|  &Nein  ')=2);
  195.         CanClose:=valid
  196.     end;
  197.  
  198.  
  199. procedure TBeispielWindow.GetWindowClass(var AWndClass: TWndClass);
  200.  
  201.     begin
  202.         inherited GetWindowClass(AWndClass);
  203.         AWndClass.hCursor:=IDC_PENCIL
  204.     end;
  205.  
  206.  
  207. function TBeispielWindow.GetClassName: string;
  208.  
  209.     begin
  210.         GetClassName:='BeispielWindow'
  211.     end;
  212.  
  213.  
  214. function TBeispielWindow.GetStyle: integer;
  215.  
  216.     begin
  217.         GetStyle:=inherited GetStyle or UPARROW or DNARROW
  218.                              or VSLIDE or LFARROW or RTARROW or HSLIDE
  219.     end;
  220.  
  221.  
  222. function TBeispielWindow.GetScroller: PScroller;
  223.  
  224.     begin
  225.         GetScroller:=new(PScroller,Init(@self,128,64,
  226.                          Application^.Attr.MaxPX shr 6,
  227.                          Application^.Attr.MaxPY shr 5))
  228.     end;
  229.  
  230.  
  231. procedure ZeichneLinienzug(p: PLinie);
  232.  
  233.     begin
  234.         p^.Zeichnen
  235.     end;
  236.  
  237.  
  238. procedure TBeispielWindow.Paint(var PaintInfo: TPaintStruct);
  239.  
  240.     begin
  241.         Zeichnung^.ForEach(@ZeichneLinienzug)
  242.     end;
  243.  
  244.  
  245. procedure TBeispielWindow.WMButton(mX,mY,BStat,KStat,Clicks: integer);
  246.     var xalt,yalt,btn,dummy: integer;
  247.         sx,sy              : longint;
  248.         pxyarray           : ptsin_ARRAY;
  249.         ALinie             : PLinie;
  250.  
  251.     begin
  252.         if bTst(BStat,1) then
  253.             if GetDC>=0 then
  254.                 begin
  255.                     wind_update(BEG_MCTRL);
  256.                     sx:=Scroller^.GetXOrg;
  257.                     sy:=Scroller^.GetYOrg;
  258.                     vsl_width(vdiHandle,Dicke);
  259.                     vsl_color(vdiHandle,Farbe);
  260.                     vsl_type(vdiHandle,Art);
  261.                     vsl_ends(vdiHandle,LE_ROUNDED,LE_ROUNDED);
  262.                     ALinie:=new(PLinie,Init(Dicke,Farbe,Art));
  263.                     Zeichnung^.Insert(ALinie);
  264.                     ALinie^.NeuerPunkt(mX-sx,mY-sy);
  265.                     repeat
  266.                         xalt:=mX;
  267.                         yalt:=mY;
  268.                         repeat
  269.                             graf_mkstate(mX,mY,btn,dummy)
  270.                         until (mX<>xalt) or (mY<>yalt) or not(bTst(btn,1));
  271.                         pxyarray[0]:=xalt;
  272.                         pxyarray[1]:=yalt;
  273.                         pxyarray[2]:=mX;
  274.                         pxyarray[3]:=mY;
  275.                         v_pline(vdiHandle,2,pxyarray);
  276.                         ALinie^.NeuerPunkt(mX-sx,mY-sy)
  277.                     until not(bTst(btn,1));
  278.                     wind_update(END_MCTRL);
  279.                     ReleaseDC;
  280.                     Veraendert:=true;
  281.                     CreateTitle;
  282.                     MyApp.saveas^.Enable;
  283.                     if length(Datei)>0 then MyApp.save^.Enable;
  284.                     MyApp.UpdateInfo
  285.                 end;
  286.         if bTst(BStat,2) then
  287.             if CanClose then
  288.                 begin
  289.                     Zeichnung^.FreeAll;
  290.                     ForceRedraw;
  291.                     Veraendert:=false;
  292.                     CreateTitle;
  293.                     MyApp.save^.Disable;
  294.                     MyApp.saveas^.Disable;
  295.                     MyApp.UpdateInfo
  296.                 end
  297.     end;
  298.  
  299.  
  300. procedure TBeispielWindow.SetAttr(Width,Color,Style: integer);
  301.     const farben: array [0..7] of string[7] =
  302.         ('weiß','schwarz','rot','grün','blau','türkis','gelb','violett');
  303.                 arten: array [1..6] of string[16] =
  304.         ('durchgehend','langer Strich','Punkte','Strich, Punkt',
  305.                                      'Strich','Strich, 2 Punkte');
  306.  
  307.     begin
  308.         Dicke:=Width;
  309.         Farbe:=Color;
  310.         Art:=Style;
  311.         SetSubTitle(' Dicke: '+ltoa(Dicke)+'  Farbe: '+farben[Farbe]+
  312.                                 '   Art: '+arten[Art])
  313.     end;
  314.  
  315.  
  316. procedure TBeispielWindow.CreateTitle;
  317.     var titel: string;
  318.  
  319.     begin
  320.         if length(Datei)=0 then titel:='[unbenannt]'
  321.         else
  322.             titel:=Pfad+Datei;
  323.         if Veraendert then titel:='*'+titel;
  324.         titel:='Beispiel  '+titel;
  325.         SetTitle(titel)
  326.     end;
  327.  
  328.  
  329. procedure SpeichereLinienzug(p: PLinie);
  330.  
  331.     begin
  332.         p^.Speichern
  333.     end;
  334.  
  335.  
  336. procedure TBeispielWindow.Speichern;
  337.  
  338.     begin
  339.         BusyMouse;
  340.         assign(f,Pfad+Datei);
  341.         rewrite(f);
  342.         Zeichnung^.ForEach(@SpeichereLinienzug);
  343.         close(f);
  344.         ArrowMouse;
  345.         Veraendert:=false;
  346.         CreateTitle
  347.     end;
  348.  
  349.  
  350. function TAttrDialog.OK: boolean;
  351.     var valid: boolean;
  352.         d,f,s: integer;
  353.         attrb: ARRAY_4;
  354.  
  355.     begin
  356.         valid:=inherited OK;
  357.         if valid then
  358.             begin
  359.                 with PLineData(TransferBuffer)^ do
  360.                     begin
  361.                         f:=0;
  362.                         while Farben[f]<>bf_Checked do inc(f);
  363.                         s:=1;
  364.                         while Stile[s]<>bf_Checked do inc(s);
  365.                         vsl_width(vdiHandle,atol(Breite))
  366.                     end;
  367.                 vql_attributes(vdiHandle,attrb);
  368.                 PBeispielWindow(Application^.MainWindow)^.SetAttr(attrb[3],f,s)
  369.             end;
  370.         OK:=valid
  371.     end;
  372.  
  373.  
  374. function TAttrDialog.Help: boolean;
  375.  
  376.     begin
  377.         Application^.Alert(@self,1,NO_ICON,'In dieser Dialogbox werden die|Attribute der Linien eingestellt.|Die neuen Werte gelten ab der|ersten Linie, die nach dem|Schließen der Box gezeichnet|wird.','   &OK   ');
  378.         Help:=false
  379.     end;
  380.  
  381.  
  382. constructor TLinie.Init(Width,Color,Style: integer);
  383.  
  384.     begin
  385.         if not(inherited Init) then fail;
  386.         new(Punkte,Init(50,50));
  387.         Dicke:=Width;
  388.         Farbe:=Color;
  389.         Art:=Style
  390.     end;
  391.  
  392.  
  393. destructor TLinie.Done;
  394.  
  395.     begin
  396.         dispose(Punkte,Done);
  397.         inherited Done
  398.     end;
  399.  
  400.  
  401. procedure TLinie.NeuerPunkt(AX,AY: integer);
  402.  
  403.     begin
  404.         Punkte^.Insert(new(PPunkt,Init(AX,AY)))
  405.     end;
  406.  
  407.  
  408. procedure TLinie.Zeichnen;
  409.     const bis: integer = pred(pts_max) shr 1;
  410.  
  411.     var q,von,ppc : longint;
  412.         vh,dx,dy,c: integer;
  413.         pxyarray  : ptsin_ARRAY;
  414.  
  415.     begin
  416.         if Punkte^.Count>1 then
  417.             begin
  418.                 with Application^ do
  419.                     begin
  420.                         vh:=vdiHandle;
  421.                         dx:=MainWindow^.Scroller^.GetXOrg;
  422.                         dy:=MainWindow^.Scroller^.GetYOrg
  423.                     end;
  424.                 vsl_width(vh,Dicke);
  425.                 vsl_color(vh,Farbe);
  426.                 vsl_type(vh,Art);
  427.                 vsl_ends(vh,LE_ROUNDED,LE_ROUNDED);
  428.                 von:=0;
  429.                 ppc:=pred(Punkte^.Count);
  430.                 while von<ppc do
  431.                     begin
  432.                         c:=0;
  433.                         for q:=von to Min(von+bis,ppc) do
  434.                             with PPunkt(Punkte^.At(q))^ do
  435.                                 begin
  436.                                     pxyarray[c]:=X+dx;
  437.                                     inc(c);
  438.                                     pxyarray[c]:=Y+dy;
  439.                                     inc(c)
  440.                                 end;
  441.                         v_pline(vh,c shr 1,pxyarray);
  442.                         inc(von,bis)
  443.                     end
  444.             end
  445.     end;
  446.  
  447.  
  448. procedure TLinie.Speichern;
  449.     var q  : longint;
  450.         cnt: integer;
  451.  
  452.     begin
  453.         cnt:=Punkte^.Count;
  454.         if cnt>0 then
  455.             begin
  456.                 write(f,Dicke,Farbe,Art,cnt);
  457.                 for q:=0 to pred(cnt) do
  458.                     with PPunkt(Punkte^.At(q))^ do
  459.                         write(f,X,Y)
  460.             end
  461.     end;
  462.  
  463.  
  464. constructor TPunkt.Init(AX,AY: integer);
  465.  
  466.     begin
  467.         if not(inherited Init) then fail;
  468.         X:=AX;
  469.         Y:=AY
  470.     end;
  471.  
  472.  
  473. procedure TAbout.Work;
  474.  
  475.     begin
  476.         if ADialog=nil then
  477.             begin
  478.                 new(ADialog,Init(nil,'Über Beispiel',BSPABOUT));
  479.                 if ADialog<>nil then
  480.                     begin
  481.                         new(PGroupBox,Init(ADialog,IGROUP,'ObjectGEM '+
  482.                                                                 'Beispielprogramm','"42"'));
  483.                         new(PButton,Init(ADialog,IOK,id_OK,true,'Mit diesem '+
  484.                                             'Button|kann die Infobox|verlassen werden.'))
  485.                     end
  486.             end;
  487.         if ADialog<>nil then ADialog^.MakeWindow
  488.     end;
  489.  
  490.  
  491. procedure TNew.Work;
  492.  
  493.     begin
  494.         with PBeispielWindow(Application^.MainWindow)^ do
  495.             if CanClose then
  496.                 begin
  497.                     Zeichnung^.FreeAll;
  498.                     ForceRedraw;
  499.                     Veraendert:=false;
  500.                     Pfad:='';
  501.                     Datei:='';
  502.                     CreateTitle;
  503.                     MyApp.save^.Disable;
  504.                     MyApp.saveas^.Disable;
  505.                     MyApp.UpdateInfo
  506.                 end
  507.     end;
  508.  
  509.  
  510. procedure TOpen.Work;
  511.     var ALinie           : PLinie;
  512.         width,color,style: integer;
  513.         cnt,x,y          : integer;
  514.         q                : longint;
  515.  
  516.     begin
  517.         with PBeispielWindow(Application^.MainWindow)^ do
  518.             if FileSelect(nil,'BEISPIEL-LINIEN LADEN','*.BLN',
  519.                                             Pfad,Datei,true) then
  520.                 begin
  521.                     BusyMouse;
  522.                     Zeichnung^.FreeAll;
  523.                     assign(f,Pfad+Datei);
  524.                     reset(f);
  525.                     while not(eof(f)) do
  526.                         begin
  527.                             read(f,width,color,style,cnt);
  528.                             ALinie:=new(PLinie,Init(width,color,style));
  529.                             Zeichnung^.Insert(ALinie);
  530.                             for q:=1 to cnt do
  531.                                 begin
  532.                                     read(f,x,y);
  533.                                     ALinie^.NeuerPunkt(x,y)
  534.                                 end
  535.                         end;
  536.                     close(f);
  537.                     ArrowMouse;
  538.                     Veraendert:=false;
  539.                     CreateTitle;
  540.                     ForceRedraw;
  541.                     MyApp.save^.Enable;
  542.                     MyApp.saveas^.Enable;
  543.                     MyApp.UpdateInfo
  544.                 end
  545.     end;
  546.  
  547.  
  548. procedure TSave.Work;
  549.  
  550.     begin
  551.         PBeispielWindow(Application^.MainWindow)^.Speichern
  552.     end;
  553.  
  554.  
  555. procedure TSaveAs.Work;
  556.  
  557.     begin
  558.         with PBeispielWindow(Application^.MainWindow)^ do
  559.             if FileSelect(nil,'BEISPIEL-LINIEN SPEICHERN','*.BLN',
  560.                                             Pfad,Datei,false) then
  561.                 begin
  562.                     Speichern;
  563.                     MyApp.save^.Enable
  564.                 end
  565.     end;
  566.  
  567.  
  568. procedure TInfo.Work;
  569.  
  570.     begin
  571.         if ADialog=nil then
  572.             begin
  573.                 new(ADialog,Init(nil,'Info',BSPINFO));
  574.                 if ADialog<>nil then
  575.                     begin
  576.                         new(st1,Init(ADialog,FPOLY,22,false,'Gibt die Anzahl|der Linienzüge an.'));
  577.                         new(st2,Init(ADialog,FLINES,24,false,'Gibt die Anzahl|der Einzellinien|aller Linienzüge|an.'));
  578.                         new(PButton,Init(ADialog,FOK,id_OK,true,'Mit diesem '+
  579.                                             'Button|kann die Infobox|verlassen werden.'))
  580.                     end
  581.             end;
  582.         if ADialog<>nil then
  583.             begin
  584.                 BerechneWerte;
  585.                 ADialog^.MakeWindow
  586.             end
  587.     end;
  588.  
  589.  
  590. procedure TInfo.BerechneWerte;
  591.     var q,anz: longint;
  592.  
  593.     begin
  594.         with PBeispielWindow(Application^.MainWindow)^ do
  595.             begin
  596.                 anz:=0;
  597.                 st1^.SetText('Linienzüge:      '+ltoa(Zeichnung^.Count));
  598.                 if Zeichnung^.Count>0 then
  599.                     for q:=0 to pred(Zeichnung^.Count) do
  600.                         inc(anz,PLinie(Zeichnung^.At(q))^.Punkte^.Count);
  601.                 st2^.SetText('Linien (gesamt): '+ltoa(anz))
  602.             end
  603.     end;
  604.  
  605.  
  606. procedure TAttrib.Work;
  607.     var ed: PEdit;
  608.         q : integer;
  609.  
  610.     begin
  611.         if ADialog=nil then
  612.             begin
  613.                 ADialog:=new(PAttrDialog,Init(nil,'Attribute',BSPATTR));
  614.                 if ADialog<>nil then
  615.                     begin
  616.                         new(PGroupBox,Init(ADialog,ACGROUP,'Farbe',
  617.                                                         'Bestimmt die|Linienfarbe'));
  618.                         new(PGroupBox,Init(ADialog,ASGROUP,'Stil',
  619.                                                         'Bestimmt den|Linienstil'));
  620.                         new(PRadioButton,Init(ADialog,AWHITE,true,
  621.                                                         'Setzt Weiß als|neue Linienfarbe'));
  622.                         new(PRadioButton,Init(ADialog,ABLACK,true,
  623.                                                         'Setzt Schwarz als|neue Linienfarbe'));
  624.                         new(PRadioButton,Init(ADialog,ARED,true,
  625.                                                         'Setzt Rot als|neue Linienfarbe'));
  626.                         new(PRadioButton,Init(ADialog,AGREEN,true,
  627.                                                         'Setzt Grün als|neue Linienfarbe'));
  628.                         new(PRadioButton,Init(ADialog,ABLUE,true,
  629.                                                         'Setzt Blau als|neue Linienfarbe'));
  630.                         new(PRadioButton,Init(ADialog,ACYAN,true,
  631.                                                         'Setzt Türkis als|neue Linienfarbe'));
  632.                         new(PRadioButton,Init(ADialog,AYELLOW,true,
  633.                                                         'Setzt Gelb als|neue Linienfarbe'));
  634.                         new(PRadioButton,Init(ADialog,AMAGENTA,true,
  635.                                                         'Setzt Violett als|neue Linienfarbe'));
  636.                         new(PRadioButton,Init(ADialog,ASOLID,true,
  637.                                                         'Setzt LT_SOLID als|neuen Linienstil'));
  638.                         new(PRadioButton,Init(ADialog,ALONG,true,
  639.                                                         'Setzt LT_LONGDASH als|neuen Linienstil'));
  640.                         new(PRadioButton,Init(ADialog,ADOTS,true,
  641.                                                         'Setzt LT_DOTTED als|neuen Linienstil'));
  642.                         new(PRadioButton,Init(ADialog,ALINEDOT,true,
  643.                                                         'Setzt LT_DASHDOT als|neuen Linienstil'));
  644.                         new(PRadioButton,Init(ADialog,ALINE,true,
  645.                                                         'Setzt LT_DASHED als|neuen Linienstil'));
  646.                         new(PRadioButton,Init(ADialog,ALIN2DOT,true,
  647.                                                         'Setzt LT_DASHDOTDOT|als neuen Linienstil'));
  648.                         ed:=new(PEdit,Init(ADialog,AWIDTH,5,
  649.                                     'Gibt die Linien-|stärke an (1,3,..).|Immer UNgerade!'));
  650.                         new(PButton,Init(ADialog,ACANCEL,id_Cancel,true,
  651.                             'Bricht den Dialog ab,|ohne die neuen Werte|zu übernehmen'));
  652.                         new(PButton,Init(ADialog,AOK,id_OK,true,
  653.                                                     'Beendet den Dialog und|setzt die neuen Werte'));
  654.                         new(PButton,Init(ADialog,AHELP,id_Help,false,
  655.                             'Zeigt einen allgemeinen|Hilfstext über diesen|Dialog an.'));
  656.                         fillchar(LineData,sizeof(LineData),0);
  657.                         with PBeispielWindow(Application^.MainWindow)^ do
  658.                             with LineData do
  659.                                 begin
  660.                                     for q:=0 to 7 do Farben[q]:=bf_Unchecked;
  661.                                     for q:=1 to 6 do Stile[q]:=bf_Unchecked;
  662.                                     Farben[Farbe]:=bf_Checked;
  663.                                     Stile[Art]:=bf_Checked;
  664.                                     Breite:=ltoa(Dicke)
  665.                                 end;
  666.                         ADialog^.TransferBuffer:=@LineData;
  667.                         ed^.SetValidator(new(PRangeValidator,Init(1,99)))
  668.                     end
  669.             end;
  670.         if ADialog<>nil then ADialog^.MakeWindow
  671.     end;
  672.  
  673.  
  674. begin
  675.     MyApp.Init('BSPL','Beispiel');
  676.     MyApp.Run;
  677.     MyApp.Done
  678. end.