LCL-GTK2: Fix CheckBox/RadioButton '_' escaping. Issue #34882, patch from Alexey Tor.

git-svn-id: trunk@60466 -
This commit is contained in:
juha 2019-02-20 09:10:22 +00:00
parent c53f302067
commit 70a3929a41
4 changed files with 8 additions and 4 deletions

View File

@ -9162,6 +9162,11 @@ begin
end;
end;
function EscapeUnderscores(const Str: String): String;
begin
Result := StringReplace(Str, '_', '__', [rfReplaceAll]);
end;
{-------------------------------------------------------------------------------
function RemoveAmpersands(Src: PChar; LineLength : Longint) : PChar;

View File

@ -591,6 +591,7 @@ procedure ConnectInternalWidgetsSignals(AWidget: PGtkWidget;
function DeleteAmpersands(var Str: String): Longint;
function Ampersands2Underscore(Src: PChar): PChar;
function Ampersands2Underscore(const ASource: String): String;
function EscapeUnderscores(const Str: String): String; inline;
function RemoveAmpersands(Src: PChar; LineLength: Longint): PChar;
function RemoveAmpersands(const ASource: String): String;
procedure LabelFromAmpersands(var AText, APattern: String; var AAccelChar: Char);

View File

@ -991,9 +991,7 @@ begin
GtkColumn := gtk_tree_view_get_column(PGtkTreeView(Widgets^.MainView), AIndex);
if GtkColumn <> nil then
gtk_tree_view_column_set_title(GtkColumn, PChar(
StringReplace(ACaption, '_', '__', [rfReplaceAll]) // Must replace single '_' to double
));
gtk_tree_view_column_set_title(GtkColumn, PChar(EscapeUnderscores(ACaption)));
end;
class procedure TGtk2WSCustomListView.ColumnSetImage(const ALV: TCustomListView;

View File

@ -1029,7 +1029,7 @@ begin
P := gtk_label_get_text(PGtkLabel(PGtkBin(BoxWidget)^.child));
B := (StrPas(P) <> AText);
gtk_widget_show(PGtkBin(BoxWidget)^.child);
gtk_button_set_label(PGtkButton(BoxWidget), PChar(Ampersands2Underscore(AText)));
gtk_button_set_label(PGtkButton(BoxWidget), PChar(Ampersands2Underscore(EscapeUnderscores(AText))));
gtk_button_set_use_underline(PGtkButton(BoxWidget), True);
if B then
begin