1 {
2 *****************************************************************************
3 * *
4 * This file is part of the ZCAD *
5 * *
6 * See the file COPYING.modifiedLGPL.txt, included in this distribution, *
7 * for details about the copyright. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
12 * *
13 *****************************************************************************
14 }
15 {
16 @author(Dimitriy P.S. (Моего тут осталось 40 - 50 %))
17 }
18 unit uzcctrllayercombobox;
19
20 {$mode objfpc}{$H+}
21
22 interface
23
24 uses
25 StdCtrls,GraphType,{types,}{$IFDEF WINDOWS}win32proc,windows,{$endif}LCLIntf,LCLType,
26 Controls,Classes,Graphics,Buttons,ExtCtrls,ComCtrls,Forms,Themes;
27 const
28 RightButtonWidth=20;// Ширина правой кнопки-стрелки при "темной" отрисовке
29
30 type
31 TLayerPropRecord=record // Запись cписка (данные в памяти)
32 _On:boolean; // Включен/выключен слой
33 Freze:boolean; // Заморозка слоя
34 Lock:boolean; // Блокировка слоя
35 Name:string; // Имя слоя
36 PLayer:pointer;
37 end;
38
39 TLayerArray=array of TLayerPropRecord;
Layernull40 TGetLayerPropFunc=function(PLayer:Pointer;out lp:TLayerPropRecord):boolean of object;
utnull41 TGetLayersArrayFunc=function(out la:TLayerArray):boolean of object;
Layernull42 TClickOnLayerPropFunc=function(PLayer:Pointer;NumProp:integer;out newlp:TLayerPropRecord):boolean of object;
43
44 TMyListView=class(TListView)
45 public
46 property DefaultItemHeight;
47 end;
48 TZCADDropDownForm=class(TCustomForm)
49 protected
50 procedure CreateParams(var Params: TCreateParams); override;
51 end;
52 TZCADLayerComboBox=class(TCustomControl) // Компонент TZCADLayerComboBox
53 private
54 Index:integer;
55 //AktivItem:TLayerPropRecord;
56 M1:boolean; // Маркер
57 PoleLista:TZCADDropDownForm;
58 sLV:TMyListView;
59 sIL:TImageList;
60 sListHeight:integer;
61 sSostoyanie:integer;
62 sIndex_ON:Integer;
63 sIndex_OFF:Integer;
64 sIndex_Freze:Integer;
65 sIndex_UnFreze:Integer;
66 sIndex_Lock:Integer;
67 sIndex_UnLock:Integer;
68 FNotClose:boolean;
69 procedure SetListHeight(AValue:integer);
ReadHeightnull70 function ReadHeight:integer;
ReadWidthnull71 function ReadWidth:integer;
72 procedure SetHeight(AValue:integer);
73 procedure SetWidth(AValue:integer);
74 procedure B1Klac(Sender:TObject);
75 procedure PLDeActivate(Sender:TObject);
76 procedure asyncfree(Data: PtrInt);
77 procedure PLDeActivate2(Data:PtrInt);
78 procedure PLDeActivate3(Data:PtrInt);
79 procedure LVKlac(Sender:TObject);
80 procedure _onKeyDown(Sender:TObject;var Key:Word;Shift:TShiftState);
81 procedure ObnovitSpisok;
82 protected
83 procedure Paint;override;
84 public
85 fGetLayerProp:TGetLayerPropFunc;
86 fGetLayersArray:TGetLayersArrayFunc;
87 fClickOnLayerProp:TClickOnLayerPropFunc;
88 constructor Create(AOwner:TComponent);override;
89 procedure ObnovitItem(li:TListItem;lp:TLayerPropRecord);
90 procedure CompareEvent(Sender: TObject; Item1, Item2: TListItem;Data: Integer; var Compare: Integer);
91 procedure MouseEnter;override;
92 procedure MouseLeave;override;
93 procedure MouseDown(Button:TMouseButton;Shift:TShiftState;X,Y:Integer);override;
94 procedure MouseUp(Button:TMouseButton;Shift:TShiftState;X,Y:Integer);override;
95 published
96 property Align;
97 property Anchors;
98 property BorderSpacing;
99 property Constraints;
100 property TabOrder;
101 property TabStop;
102 property Visible;
103 property Enabled;
104 property Hint;
105 property ShowHint;
106 property Height:integer read ReadHeight write SetHeight;
107 property Width:integer read ReadWidth write SetWidth;
108 property ListHeight:integer read sListHeight write SetListHeight;
109 property ImageList:TImageList read sIL write sIL;
110 property Index_ON:integer read sIndex_ON write sIndex_ON;
111 property Index_OFF:integer read sIndex_OFF write sIndex_OFF;
112 property Index_Freze:integer read sIndex_Freze write sIndex_Freze;
113 property Index_UnFreze:integer read sIndex_UnFreze write sIndex_UnFreze;
114 property Index_Lock:integer read sIndex_Lock write sIndex_Lock;
115 property Index_UnLock:integer read sIndex_UnLock write sIndex_UnLock;
116 end;
117
118 implementation
119
120 procedure TZCADDropDownForm.CreateParams(var Params: TCreateParams);
121 begin
122 inherited CreateParams(Params);
123 end;
124
125 procedure DrawComboBoxButton(ACanvas:TCanvas;ADown,AMouseInControl,ADisabled:Boolean; ARect:TRect);
126 var
127 ComboElem: TThemedComboBox;
128 Details: TThemedElementDetails;
129 begin
130 {$IFNDEF UNIX}inflaterect(ARect,-1,-1){$ENDIF};
131 if ADown then
132 ComboElem := tcDropDownButtonPressed
133 else if AMouseInControl then
134 ComboElem := tcDropDownButtonHot
135 else if ADisabled then
136 begin
137 {$IFDEF UNIX}
138 ComboElem := tcDropDownButtonDisabled
139 {$ELSE}
140 if WindowsVersion >= wvVista then
141 begin
142 ThemeServices.DrawElement(ACanvas.Handle, ThemeServices.GetElementDetails(ttbSplitButtonDropDownDisabled),ARect);
143 exit;
144 end
145 else ComboElem := tcDropDownButtonDisabled
146 {$ENDIF};
147 end
148 else
149 begin
150 {$IFDEF UNIX}
151 ComboElem := tcDropDownButtonNormal;
152 {$ELSE}
153 if WindowsVersion >= wvVista then
154 begin
155 ThemeServices.DrawElement(ACanvas.Handle, ThemeServices.GetElementDetails(ttbSplitButtonDropDownNormal),ARect);
156 exit;
157 end
158 else ComboElem := tcDropDownButtonNormal
159 {$ENDIF};
160 end;
161 Details := ThemeServices.GetElementDetails(ComboElem);
162 ThemeServices.DrawElement(ACanvas.Handle, Details, ARect);
163 end;
164
165 procedure DrawComboBoxBox(ACanvas:TCanvas;ADown,AMouseInControl,ADisabled:Boolean; ARect:TRect);
166 var
167 ComboElem: {$IFDEF UNIX}TThemedButton{$ELSE}TThemedEdit{$ENDIF};
168 Details: TThemedElementDetails;
169 i,n,h,w,HalfRightButtonWidth:integer;
170 begin
171 if ThemeServices.ThemesEnabled then
172 begin
173 if AMouseInControl then ComboElem:={$IFDEF UNIX}tbPushButtonHot{$ELSE}teEditTextHot{$ENDIF} else
174 begin
175 if ADisabled then ComboElem:={$IFDEF UNIX}tbPushButtonDisabled{$ELSE}teEditTextReadOnly{teEditTextDisabled}{$ENDIF} else ComboElem:={$IFDEF UNIX}tbPushButtonNormal{$ELSE}teEditTextNormal{$ENDIF};
176 end;
177 //ComboElem := {$IFDEF UNIX}tbPushButtonNormal{$ELSE}teEditTextNormal{$ENDIF};
178 Details:=ThemeServices.GetElementDetails(ComboElem);
179 ThemeServices.DrawElement(ACanvas.Handle,Details,ARect);
180 ARect.Left:=ARect.Right-RightButtonWidth;
181 DrawComboBoxButton(ACanvas,ADown,AMouseInControl,ADisabled,ARect);
182 end
183 else
184 begin
185 h:=ARect.Bottom-ARect.Top;
186 w:=ARect.Right-ARect.Left;
187 with ACanvas do
188 begin
189 HalfRightButtonWidth:=RightButtonWidth div 2;
190 // Основа
191 Pen.Style:=psSolid;
192 Pen.Color:=clWindow;
193 for i:=1 to w-2 do
194 begin
195 MoveTo(0,i);
196 LineTo(w-RightButtonWidth,i);
197 end;
198 // Кнопка
199 Pen.Color:=clForm;
200 for i:=0 to h-1 do
201 begin
202 MoveTo(w-RightButtonWidth,i);
203 LineTo(w-1,i);
204 end;
205 if AMouseInControl then Pen.Color:=clActiveBorder else Pen.Color:=clInactiveBorder;
206 // Бордюр
207 MoveTo(0,0);
208 LineTo(w-1,0);
209 LineTo(w-1,h-1);
210 LineTo(0,h-1);
211 LineTo(0,0);
212 MoveTo(w-RightButtonWidth+1,0);
213 LineTo(w-RightButtonWidth+1,h-1);
214 // Стрелка?
215 Pen.Style:=psSolid;
216 if AMouseInControl then Pen.Color:=clGrayText else Pen.Color:=clWindowText;
217 n:=12;
218 for i:=(h-12) div 2 to (h-12) div 2+12 do
219 begin
220 MoveTo(w-HalfRightButtonWidth-(n div 2),i);
221 LineTo(w-HalfRightButtonWidth+(n div 2),i);
222 n:=n-1;
223 if n=1 then system.break;// без этого стрелка кривая в qt
224 end;
225 end;
226 end;
227 (*
228 {$IFDEF UNIX}
229 with ACanvas do
230 begin
231 Pen.Style:=psSolid;
232 if AMouseInControl then Pen.Color:=clGrayText else Pen.Color:=clWindowText;
233 n:=12;
234 for i:=(Height-12) div 2 to (Height-12) div 2+12 do
235 begin
236 MoveTo(Width-15-(n div 2),i);
237 LineTo(Width-15+(n div 2),i);
238 n:=n-1;
239 end;
240 end;
241 {$ELSE}
242 DrawComboBoxButton(ACanvas,ADown,AMouseInControl,ADisabled,ARect);
243 {$ENDIF}
244 *)
245 end;
246
247 //============================================================================//
248
249 constructor TZCADLayerComboBox.Create(AOwner:TComponent); // Создание объекта класса
250 begin
251 inherited Create(AOwner);
252 M1:=false;
253 sIL:=nil; // На всякий случай
254 sIndex_ON:=-1;
255 sIndex_OFF:=-1;
256 sIndex_Freze:=-1;
257 sIndex_UnFreze:=-1;
258 sIndex_Lock:=-1;
259 sIndex_UnLock:=-1;
260 sListHeight:=-1;
261 Index:=-1;
262 sSostoyanie:=1;
263 FNotClose:=false;
264 autosize:=true;
265 OnClick:=@B1Klac;
266 Application.OnDeactivate:=@PLDeActivate;
267 end;
268
269 procedure TZCADLayerComboBox.Paint; // Отрисовка
270 var
271 lp:TLayerPropRecord;
272 TxRect:TRect;
273 MD,MIC:boolean;
274 begin
275 inherited Paint;
276 if Visible=true then
277 begin
278 with Canvas do
279 begin
280 Lock;
281 if sSostoyanie<3 then MD:=false else MD:=true;
282 if sSostoyanie<2 then MIC:=false else MIC:=true;
283 DrawComboBoxBox(Canvas,MD,MIC,not Enabled,ClientRect);
284 Brush.Style:=bsClear;
285 if fGetLayerProp(nil,lp) then
286 begin
287 // Отрисовываем иконки состояния выбранного слоя и надпись (имя выбранного слоя)
288 if sIL<>nil then
289 begin
290 //Я заменил Height на ClientHeight, неработало в винде, в лине видимо канвас в абсолютных координатах, поэтому там работало
291 //разбил по строкам чтоб при отладке было ясно видно then или else выполняется
292 if (sIndex_OFF>=0) and (sIndex_ON>=0) and (sIndex_OFF<sIL.Count) and (sIndex_ON<sIL.Count) then
293 begin
294 if lp._On then
295 sIL.Draw(Canvas,1,(ClientHeight-16) div 2,sIndex_ON,gdeNormal)
296 else
297 sIL.Draw(Canvas,1,(ClientHeight-16) div 2,sIndex_OFF,gdeNormal);
298 end;
299 if (sIndex_Freze>=0) and (sIndex_UnFreze>=0) and (sIndex_Freze<sIL.Count) and (sIndex_UnFreze<sIL.Count) then
300 begin
301 if lp.Freze then
302 sIL.Draw(Canvas,18,(ClientHeight-16) div 2,sIndex_Freze,gdeNormal)
303 else
304 sIL.Draw(Canvas,18,(ClientHeight-16) div 2,sIndex_UnFreze,gdeNormal);
305 end;
306 if (sIndex_Lock>=0) and (sIndex_UnLock>=0) and (sIndex_Lock<sIL.Count) and (sIndex_UnLock<sIL.Count) then
307 begin
308 if lp.Lock then
309 sIL.Draw(Canvas,35,(ClientHeight-16) div 2,sIndex_Lock,gdeNormal)
310 else
311 sIL.Draw(Canvas,35,(ClientHeight-16) div 2,sIndex_UnLock,gdeNormal);
312 end;
313 end;
314 TxRect:=ClientRect;//получение клиентской области
315 //InflateRect(TxRect,-1,-1);//уменьшение ее на 1 пиксель внутрь по x и y
316 TxRect.Left:=TxRect.Left+55;//сдвиг к началу текста
317 TxRect.Right:=TxRect.Right-RightButtonWidth;//сдвиг к началу текста
318 TextRect(TxRect,55,(ClientHeight-TextHeight(lp.Name)) div 2,lp.Name); // Видимо функция TextRect попросту не работает... может когданибудь заработает? (текст не ограничивается по рамке)
319 end;
320 Unlock;
321 end;
322 end;
323 end;
324
325 procedure TZCADLayerComboBox.CompareEvent(Sender: TObject; Item1, Item2: TListItem; Data: Integer; var Compare: Integer);
326 begin
327 if Item1.SubItems[2]>Item2.SubItems[2] then compare:=1 else
328 begin
329 if Item1.SubItems[2]=Item2.SubItems[2] then compare:=0 else compare:=-1;
330 end;
331 end;
332
333 procedure TZCADLayerComboBox.SetListHeight(AValue:integer); // Изменение свойства высоты разворачиваемого списка
334 begin
335 sListHeight:=AValue;
336 if sListHeight<30 then sListHeight:=30;
337 end;
338
ReadHeightnull339 function TZCADLayerComboBox.ReadHeight:integer; // Возвращает значение параметра высоты
340 begin
341 result:=inherited Height;
342 end;
343
TZCADLayerComboBox.ReadWidthnull344 function TZCADLayerComboBox.ReadWidth:integer; // Возвращает значение параметра ширины
345 begin
346 result:=inherited Width;
347 end;
348
349 procedure TZCADLayerComboBox.SetHeight(AValue:integer); // Задаёт значение параметра высоты
350 begin
351 if AValue<18 then AValue:=18;
352 inherited Height:=AValue;
353 Invalidate;
354 end;
355
356 procedure TZCADLayerComboBox.SetWidth(AValue:integer); // Задаёт значение параметра ширины
357 begin
358 if AValue<120 then AValue:=120;
359 inherited Width:=AValue;
360 Invalidate;
361 end;
362
363 procedure TZCADLayerComboBox.B1Klac(Sender:TObject); // Открытие развёрнутого списка
364 var
365 a:TPoint;
366 h,hh:integer;
367 begin
368 if (PoleLista=nil) and (M1=false) then
369 begin
370 PoleLista:=TZCADDropDownForm.Create(self);
371 PoleLista.Width:=Width;
372 a.X:=0;
373 a.Y:=Height;
374 a:=ClientToScreen(a);
375 PoleLista.Left:=a.x;
376 PoleLista.Top:=a.y;
377 PoleLista.BorderStyle:=bsNone;
378 PoleLista.OnDeactivate:=@PLDeActivate;
379 PoleLista.ShowInTaskBar:=stNever;
380 sLV:=TmyListView.Create(PoleLista);
381 {$IFDEF WINDOWS}
382 sLV.BorderStyle:={bsSingle}bsNone;
383 {$endif}
384 {$IFNDEF WINDOWS}
385 sLV.BorderStyle:=bsSingle;
386 {$endif}
387 sLV.Parent:=PoleLista;
388 sLV.Align:=alClient;
389 sLV.ReadOnly:=true;
390 sLV.MultiSelect:=false;
391 sLV.SmallImages:=sIL;
392 sLV.RowSelect:=true;
393 sLV.ViewStyle:=vsReport;
394 sLV.ShowColumnHeaders:=false;
395 sLV.SortColumn:=3;
396 sLV.ScrollBars:=ssAutoVertical;
397 sLV.Columns.Add;
398 sLV.Columns.Items[0].Width:=18;
399 sLV.Columns.Add;
400 sLV.Columns.Items[1].Width:=18;
401 sLV.Columns.Add;
402 sLV.Columns.Items[2].Width:=18;
403 sLV.Columns.Add;
404 sLV.Columns.Items[3].Width:=PoleLista.Width-18*3-30;
405 sLV.OnClick:=@LVKlac;
406 sLV.OnKeyDown:=@_onKeyDown;
407 sLV.OnCompare:=@Compareevent;
408 ObnovitSpisok;
409 if sListHeight>0 then
410 PoleLista.Height:=sListHeight
411 else
412 begin
413 sLV.DefaultItemHeight:=-1;
414 hh:=sLV.Height-sLV.ClientHeight;
415 hh:=screen.WorkAreaHeight-a.y-1;
416 {$IFDEF UNIX}h:=sLV.Items.Count*(sLV.DefaultItemHeight+1)+10;
417 {$ELSE}h:=sLV.Items.Count*(sLV.DefaultItemHeight-1)+4;{$ENDIF}
418 if h>hh then h:=hh;
419 PoleLista.ClientHeight:=h;
420 end;
421
422 {$IFDEF WINDOWS}
423 SetWindowLong(PoleLista.Handle,GWL_STYLE,GetWindowLong(PoleLista.Handle,GWL_STYLE) or ws_border);
424 SetClassLongPtr(PoleLista.Handle,GCL_STYLE,GetClassLongPtr(PoleLista.Handle,GCL_STYLE) or CS_DROPSHADOW);
425 SetWindowPos(PoleLista.Handle,0, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER or SWP_FRAMECHANGED);
426 {$endif}
427 PoleLista.Show;
428 end;
429 if (PoleLista=nil) and (M1=true) then M1:=false;
430 end;
431
432 procedure TZCADLayerComboBox.asyncfree(Data:PtrInt);
433 begin
434 Tobject(Data).Free;
435 end;
436
437 procedure TZCADLayerComboBox.PLDeActivate(Sender:TObject); // Закрытие списка
438 var
439 S,P:TPoint;
440 begin
441 if FNotClose then exit;
442 if PoleLista<>nil then
443 begin
444 Application.QueueAsyncCall(@asyncfree,PtrInt(PoleLista));
445 PoleLista:=nil;
446 S.X:=0;
447 S.Y:=0;
448 P:=ScreenToClient(S);
449 S:=Mouse.CursorPos;
450 P.X:=P.X+S.X;
451 P.Y:=P.Y+S.Y;
452 if ((P.Y>0) and (P.Y<Height))and((P.X>0) and (P.X<Width)) then M1:=true;
453 end;
454 Invalidate;
455 end;
456
457 procedure TZCADLayerComboBox.PLDeActivate2(Data:PtrInt); // Закрытие списка 2
458 begin
459 PLDeActivate(nil);
460 end;
461
462 procedure TZCADLayerComboBox.PLDeActivate3(Data:PtrInt); // Закрытие списка 3
463 begin
464 if PoleLista<>nil then
465 begin
466 PoleLista.Free;
467 PoleLista:=nil;
468 M1:=false;
469 end;
470 end;
471
472 procedure TZCADLayerComboBox.ObnovitItem(li:TListItem;lp:TLayerPropRecord);
473 begin
474 li.SubItems[2]:=lp.Name;
475 li.Data:=lp.PLayer;
476 if sIL<>nil then
477 begin
478 if lp._On then li.ImageIndex:=sIndex_ON else li.ImageIndex:=sIndex_OFF;
479 if lp.Freze then li.SubItemImages[0]:=sIndex_Freze else li.SubItemImages[0]:=sIndex_UnFreze;
480 if lp.Lock then li.SubItemImages[1]:=sIndex_Lock else li.SubItemImages[1]:=sIndex_UnLock;
481 end;
482 end;
483
484 procedure TZCADLayerComboBox.ObnovitSpisok; // Заполнение (обновление) списка развёрнутого листа
485 var
486 n:integer;
487 LayerArray:TLayerArray;
488 begin
489 if PoleLista<>nil then
490 if assigned(fGetLayersArray)then
491 if fGetLayersArray(LayerArray)then
492 begin
493 sLV.BeginUpdate;
494 sLV.Items.Clear;
495 for n:=low(LayerArray) to high(layerarray) do
496 begin
497 sLV.Items.Add;
498 sLV.Items.Item[n].SubItems.Add('');
499 sLV.Items.Item[n].SubItems.Add('');
500 sLV.Items.Item[n].SubItems.Add('');
501 ObnovitItem(sLV.Items.Item[n],LayerArray[n]);
502 end;
503 sLV.SortType:=stBoth;
504 sLV.EndUpdate;
505 end;
506 end;
507
508 procedure TZCADLayerComboBox.LVKlac(Sender:TObject); // Обработков кликов на развёрнутом списке
509 var
510 LVItem:TListItem;
511 KlacPoint,KlacContrlPoint,S:TPoint;
512 NumProp,colwidth,i:integer;
513 collapsed:boolean;
514 newlp:TLayerPropRecord;
515 begin
516 if sLV.Items.Count>0 then
517 begin
518 FNotClose:=true;
519 S.X:=0;
520 S.Y:=0;
521 KlacContrlPoint:=sLV.ScreenToClient(S);
522 S:=Mouse.CursorPos;
523 KlacPoint.X:=S.X+KlacContrlPoint.X;
524 KlacPoint.Y:=S.Y+KlacContrlPoint.Y;
525 LVItem:=nil;
526 LVItem:=sLV.GetItemAt(KlacPoint.X,KlacPoint.Y);
527 if LVItem<>nil then
528 begin
529 sLV.BeginUpdate;
530 numprop:=0;
531 colwidth:=0;
532 for i:=0 to sLV.ColumnCount-1 do
533 begin
534 colwidth:=colwidth+sLV.column[i].Width;
535 if KlacPoint.x>colwidth then inc(numprop) else break;
536 end;
537 if assigned(fClickOnLayerProp)then collapsed:=fClickOnLayerProp(LVItem.Data,NumProp,newlp);
538 LVItem.Focused:=false;
539 LVItem.Selected:=false;
540 ObnovitItem(LVItem,newlp);
541 sLV.EndUpdate;
542 if collapsed then Application.QueueAsyncCall(@PLDeActivate2,0);
543 FNotClose:=false;
544 end;
545 end;
546 end;
547
548 procedure TZCADLayerComboBox._onKeyDown(Sender:TObject;var Key:Word;Shift:TShiftState); // Отлавливаем эскей
549 begin
550 if Key=27 then Application.QueueAsyncCall(@PLDeActivate3,0);
551 end;
552
553 procedure TZCADLayerComboBox.MouseEnter; // Курсор мышки зашёл на кнопку
554 begin
555 if sSostoyanie=2 then exit;
556 sSostoyanie:=2;
557 Invalidate;
558 end;
559
560 procedure TZCADLayerComboBox.MouseLeave; // Курсор мыши вышел за кнопку
561 begin
562 if sSostoyanie=1 then exit;
563 sSostoyanie:=1;
564 Invalidate;
565 end;
566
567 procedure TZCADLayerComboBox.MouseDown(Button:TMouseButton;Shift:TShiftState;X,Y:Integer); // Нажата кнопка мыши
568 begin
569 if sSostoyanie=3 then exit;
570 if Button=mbLeft then
571 begin
572 sSostoyanie:=3;
573 Invalidate;
574 end;
575 end;
576
577 procedure TZCADLayerComboBox.MouseUp(Button:TMouseButton;Shift:TShiftState;X,Y:Integer); // Отжата кнопка мыши
578 begin
579 if sSostoyanie<>3 then exit;
580 if Button=mbLeft then
581 begin
582 if ((X>=0)and(X<Width))and((Y>=0)and(Y<=Height)) then sSostoyanie:=2 else sSostoyanie:=1;
583 Invalidate;
584 end;
585 end;
586
587 //============================================================================//
588
589 end.
590