fix(android): the search field stops moving, and the magnifier steps aside
Showing and hiding the clear button changed the field's width on every keystroke, so the whole row jumped. Its slot is now reserved permanently and only the cross itself appears - the field keeps one width. The magnifier also fades once typing starts: it was there to say what the field is, and once there is a query it tells you nothing you cannot see. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+17
-5
@@ -108,7 +108,9 @@ type
|
||||
// --- ecran 2 : liste
|
||||
FLayList: TLayout;
|
||||
FSearch: TEdit;
|
||||
FSearchHint: TLabel;
|
||||
FSearchHint, FSearchClearMark: TLabel;
|
||||
FSearchGlass: TCircle;
|
||||
FSearchHandle: TLine;
|
||||
FSearchClear: TRectangle;
|
||||
/// Choix du dossier : un bouton peint, et un panneau de selection montre
|
||||
/// a la demande. FFolders[0] est toujours « tous les dossiers ».
|
||||
@@ -458,13 +460,15 @@ begin
|
||||
LSearchWrap.Parent := LTop;
|
||||
LSearchWrap.Align := TAlignLayout.Client;
|
||||
|
||||
// La place de la croix est RESERVEE en permanence : la montrer et la cacher
|
||||
// faisait changer la largeur du champ a chaque frappe, et la ligne sautait.
|
||||
// Seule la croix elle-meme apparait et disparait.
|
||||
FSearchClear := TRectangle.Create(Self);
|
||||
FSearchClear.Parent := LSearchWrap;
|
||||
FSearchClear.Align := TAlignLayout.Right;
|
||||
FSearchClear.Width := 46;
|
||||
FSearchClear.Fill.Kind := TBrushKind.None; // invisible, mais cliquable
|
||||
FSearchClear.Stroke.Kind := TBrushKind.None;
|
||||
FSearchClear.Visible := False;
|
||||
FSearchClear.OnClick := OnSearchClear;
|
||||
|
||||
LClearMark := TLabel.Create(FSearchClear);
|
||||
@@ -474,7 +478,9 @@ begin
|
||||
LClearMark.Text := 'X';
|
||||
LClearMark.TextSettings.HorzAlign := TTextAlign.Center;
|
||||
LClearMark.TextSettings.VertAlign := TTextAlign.Center;
|
||||
LClearMark.Visible := False;
|
||||
Tint(LClearMark, 17, True);
|
||||
FSearchClearMark := LClearMark;
|
||||
|
||||
// Le champ reste natif - il faut un clavier - et son fond vient desormais du
|
||||
// style, recolore a la palette par make-style.ps1. PAS de rectangle derriere
|
||||
@@ -493,7 +499,8 @@ begin
|
||||
// Loupe DESSINEE dans le champ. Un enfant qui ne fait que se peindre y est
|
||||
// accepte - c'est le cliquable qui ne l'est pas. Un cercle et un manche
|
||||
// plutot qu'un glyphe : aucune police n'est garantie sur tous les appareils.
|
||||
LGlass := TCircle.Create(FSearch);
|
||||
FSearchGlass := TCircle.Create(FSearch);
|
||||
LGlass := FSearchGlass;
|
||||
LGlass.Parent := FSearch;
|
||||
LGlass.Align := TAlignLayout.None;
|
||||
LGlass.SetBounds(16, 15, 15, 15);
|
||||
@@ -502,7 +509,8 @@ begin
|
||||
LGlass.Stroke.Thickness := 2;
|
||||
LGlass.HitTest := False;
|
||||
|
||||
LHandle := TLine.Create(FSearch);
|
||||
FSearchHandle := TLine.Create(FSearch);
|
||||
LHandle := FSearchHandle;
|
||||
LHandle.Parent := FSearch;
|
||||
LHandle.Align := TAlignLayout.None;
|
||||
LHandle.SetBounds(29, 28, 6, 6);
|
||||
@@ -1440,8 +1448,12 @@ begin
|
||||
// quelques centaines d'entrees c'est imperceptible ; passer a un modele
|
||||
// virtuel (TListView) le jour ou ca rame.
|
||||
Touch;
|
||||
// La loupe s'efface des qu'on tape : elle a servi a dire ce qu'est le
|
||||
// champ, et une fois la saisie commencee elle n'apprend plus rien.
|
||||
FSearchHint.Visible := FSearch.Text = '';
|
||||
FSearchClear.Visible := FSearch.Text <> '';
|
||||
FSearchGlass.Visible := FSearch.Text = '';
|
||||
FSearchHandle.Visible := FSearch.Text = '';
|
||||
FSearchClearMark.Visible := FSearch.Text <> '';
|
||||
LFolder := '';
|
||||
if (FFolderSel > 0) and (FFolderSel <= High(FFolderNames)) then
|
||||
LFolder := FFolderNames[FFolderSel]; // 0 = tous les dossiers
|
||||
|
||||
Reference in New Issue
Block a user