fix(android): draw the search hint ourselves, TextPrompt needs a style object

Dark.style has no object for the prompt text, so the search field sat there
empty and mute. A label inside the field, hit-test off so the tap goes
through, shown only while the field is empty.

Fourth time today the same conclusion: whatever FMX renders through a style
template may or may not exist in the style actually loaded. Built explicitly,
it is there.

Also noted: the row height was never wrong. 56 logical units on a 3x display
are the ~166 device pixels the screenshot showed - only the second line was
missing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
r-zakarya
2026-08-15 16:04:01 +01:00
parent 31ee1b45c6
commit 65e6ba6a54
+14 -1
View File
@@ -98,6 +98,7 @@ type
// --- ecran 2 : liste // --- ecran 2 : liste
FLayList: TLayout; FLayList: TLayout;
FSearch: TEdit; FSearch: TEdit;
FSearchHint: TLabel;
FFolderBox: TComboBox; FFolderBox: TComboBox;
FList: TListBox; FList: TListBox;
FCount: TLabel; FCount: TLabel;
@@ -398,8 +399,19 @@ begin
FSearch := TEdit.Create(Self); FSearch := TEdit.Create(Self);
FSearch.Parent := LTop; FSearch.Parent := LTop;
FSearch.Align := TAlignLayout.Client; FSearch.Align := TAlignLayout.Client;
FSearch.TextPrompt := 'Rechercher';
FSearch.OnChangeTracking := OnSearchChanged; FSearch.OnChangeTracking := OnSearchChanged;
// Invite dessinee par nous, pas par TextPrompt : Dark.style ne comporte pas
// l'objet que le style est cense fournir pour l'afficher, et le champ
// restait donc vide et muet. HitTest desactive pour que le clic traverse
// jusqu'au champ.
FSearchHint := TLabel.Create(FSearch);
FSearchHint.Parent := FSearch;
FSearchHint.Align := TAlignLayout.Client;
FSearchHint.Margins.Left := 10;
FSearchHint.HitTest := False;
FSearchHint.Opacity := 0.45;
FSearchHint.Text := 'Rechercher';
end; end;
/// Intitule discret au-dessus d'une valeur. Meme forme pour toutes les /// Intitule discret au-dessus d'une valeur. Meme forme pour toutes les
@@ -1163,6 +1175,7 @@ begin
// quelques centaines d'entrees c'est imperceptible ; passer a un modele // quelques centaines d'entrees c'est imperceptible ; passer a un modele
// virtuel (TListView) le jour ou ca rame. // virtuel (TListView) le jour ou ca rame.
Touch; Touch;
FSearchHint.Visible := FSearch.Text = '';
LFolder := ''; LFolder := '';
if FFolderBox.ItemIndex > 0 then // 0 = tous les dossiers if FFolderBox.ItemIndex > 0 then // 0 = tous les dossiers
LFolder := FFolderBox.Items[FFolderBox.ItemIndex]; LFolder := FFolderBox.Items[FFolderBox.ItemIndex];