[SOLVED] Edit component with Clear icon available? lazarus / 31-LCL ---------------------------------------------------------------------- wittbo · 2020-10-28 12:15 I often see software or internet pages containing edit fields, which contain a clickable "Clear" icon, that can be used to clear an edit field with a single mouse click (s.b.). Does anyone know, if there is a similiar component available for Lazarus LCL? ---------------------------------------------------------------------- wp · 2020-10-28 12:38 Use the TEditButton on the Misc palette. It contains a button next to the edit (it is not embedded in the edit, though), you can assign a Glyph or an image from an attached imagelist, and you can write the handler of the OnButtonClick event to erase the edit. ---------------------------------------------------------------------- Blaazen · 2020-10-28 13:40 Such component is not impossible. I did a quick test - see screenshot. The background is paintbox: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.PaintBox1Paint(Sender: TObject);var aRect: TRect;    aDets: TThemedElementDetails;begin  with TPaintBox(Sender) do    begin      aRect:=Rect(2, 2, 198, 18);      Canvas.Brush.Color:=clLime;      Canvas.FillRect(aRect);      aRect:=Rect(0, 0, 200, 20);      aDets:=ThemeServices.GetElementDetails(teEditTextFocused);      ThemeServices.DrawElement(Canvas.Handle, aDets, aRect)    end;end;and normal TEdit with border bsNone is placed over it. It would be possible to join it into one component. ---------------------------------------------------------------------- jamie · 2020-10-28 20:50 I don't know how well supporting the widget is for the mac but  you could place a Tedit on a TPanel and set the border for the TEDIT to none, then on the panel you set the border and place an icon using a timage to the right. ---------------------------------------------------------------------- Blaazen · 2020-10-28 21:15 Unfortunately, Themes paints EditText frame in Qt4 only. GTK2 and Qt5 don't paint anything. My idea of themed TEdit would be a component with a very limited usage. ---------------------------------------------------------------------- wittbo · 2020-10-29 10:26 Thanks to all for your hints. @Blaazen:  Since themes are limited to QT4, I discardrd this solution. But, using themes and themesservices was a complete new programming ascpect for me; i never used it before. Very interesting. @WP: TEditButton works as expected on the Mac, no problems. Simple solution, easy to use. @jamie: Very good idea, looks nice and also easy to implement. This could become my way. ---------------------------------------------------------------------- JuhaManninen · 2020-10-29 11:57 Quote from: wittbo on October 29, 2020, 11:26:40 am@WP: TEditButton works as expected on the Mac, no problems. Simple solution, easy to use. +1 It is used in the FilterEdit controls around Lazarus IDE exactly for clearing the edit field. The icon there is a funnel with red 'x', maybe not useful in your case.