summaryrefslogtreecommitdiff
path: root/libgtk_kylix
diff options
context:
space:
mode:
Diffstat (limited to 'libgtk_kylix')
-rw-r--r--libgtk_kylix/GTKForms.pas2
-rw-r--r--libgtk_kylix/GTKUtils.pas17
2 files changed, 18 insertions, 1 deletions
diff --git a/libgtk_kylix/GTKForms.pas b/libgtk_kylix/GTKForms.pas
index d6c650b..f1f5440 100644
--- a/libgtk_kylix/GTKForms.pas
+++ b/libgtk_kylix/GTKForms.pas
@@ -737,7 +737,7 @@ begin
Exit;
end;
Dialog := gtk_message_dialog_new(ParentWindow, GTK_DIALOG_MODAL or GTK_DIALOG_DESTROY_WITH_PARENT, TMessageStyleID[Integer(Style)],
- GTK_BUTTONS_NONE, StringToPgchar(Text));
+ GTK_BUTTONS_NONE, StringToPgchar(EscapeFormatStr(Text)));
for i := 1 to NumMessageButtons do
if TMessageButton(i - 1) in Buttons
then gtk_dialog_add_button(PGtkDialog(Dialog), MessageButtonID[i], i);
diff --git a/libgtk_kylix/GTKUtils.pas b/libgtk_kylix/GTKUtils.pas
index 787b133..3f92168 100644
--- a/libgtk_kylix/GTKUtils.pas
+++ b/libgtk_kylix/GTKUtils.pas
@@ -45,6 +45,7 @@ function GDKColorToPGdkColor(Color: TGDKColor): PGdkColor;
function PGdkColorToGDKColor(Color: PGdkColor): TGDKColor;
function GDKColorToString(Color: TGDKColor): string;
function StringToGDKColor(Str: string; var Color: TGDKColor): boolean;
+function EscapeFormatStr(const Str: string): string;
(********************************************************************************************************************************)
implementation
@@ -207,5 +208,21 @@ begin
end;
(********************************************************************************************************************************)
+function EscapeFormatStr(const Str: string): string;
+var i: integer;
+ src: string;
+begin
+ src := Str;
+ Result := '';
+ repeat
+ i := Pos('%', src);
+ if i > 0 then begin
+ Result := Result + Copy(src, 1, i - 1) + '%%';
+ src := Copy(src, i + 1, MaxInt);
+ end else Result := Result + src;
+ until i <= 0;
+end;
+
+(********************************************************************************************************************************)
end.