[Solved] Property NullDisplayText lazarus / 16-Databases ---------------------------------------------------------------------- sierdolg · 2018-02-23 11:02 Hello experts, is there something equivalent to a .nulldisplaytext property, displayable in a database aware control to indicate that its value is not set in the resultset, like "n/a" instead of "". [Which could also useful to display a hint to enter what sort of missing data ,-)] An alternative idea might be to extend the Delphi compatible .DisplayFormat of a dataset's field whith its up to three components (positive, negative, zero value) to an optional fourth component (for NULL/EMPTY values). Has anybody already found a nice solution for that purpose? ---------------------------------------------------------------------- marcov · 2018-02-23 11:56 You can hook the event that gets the displaytext, and do whatever transformation you want. The classic reason to do that is for memo fields that are typically not shown in grids. e.g. 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 TSqlCreateFrm.defaultgettext(Sender: TField; var Textit: string;  DisplayText: Boolean);begin    if DisplayText then     Textit := Copy(sender.AsString, 1, 50) // in case for display text, only show part  else     Textit:=sender.AsString;end; In the designer or in code set thegrid.ongettext to defaultgettext; ---------------------------------------------------------------------- rvk · 2018-02-23 12:13 Quote from: sierdolg on February 23, 2018, 12:02:44 pmis there something equivalent to a .nulldisplaytext property, displayable in a database aware control to indicate that its value is not set in the resultset, like "n/a" instead of "". For TEdit there is TEdit.TextHint which shows the text in grey when it is empty. TDBEdit also has the TextHint but it isn't published. So I'm not sure it works for NULL. You can try setting it in code. ---------------------------------------------------------------------- sierdolg · 2018-02-26 12:18 Dear rvk, this .TextHint property is and does _exactly_ what I was looking for. (First and foremost it also automatically clears this hint on entering the field.) And works for the NULL value. Thanks a lot! (Supposably its name "hint" set me on the wrong track, as I thought of a hovering hint.) Hence the only remaining small question might be why not to publish such a useful property to the object inspector ,-)