View Issue Details

IDProjectCategoryView StatusLast Update
0037803LazarusWidgetsetpublic2020-10-05 13:39
ReporterCudaText man_ Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
OSUbuntu 20 x64 
Product Version2.1 (SVN) 
Summary0037803: gtk2: MessageBox isn't shown if HTML brackets are in text
DescriptionI found that CudaText shows empty install prompt for HTML Completion plugin. Regression.
Demo
https://github.com/Alexey-T/Lazarus_test_messageboxes

Call it and paste msg text, attached in file. Press "AskUser" button - messagebox is empty.
TagsNo tags attached.
Fixed in Revisionr63927
LazTarget-
WidgetsetGTK 2
Attached Files

Relationships

related to 0037804 closedJuha Manninen gtk3: MessageBox is empty if text has HTML brackets 

Activities

CudaText man_

2020-09-24 00:57

reporter  

err.png (61,949 bytes)   
err.png (61,949 bytes)   
caption.zip (258 bytes)

Juha Manninen

2020-09-24 17:16

developer   ~0125824

What do you mean by "Regression"? Which revision changed the behavior?

CudaText man_

2020-09-24 17:34

reporter   ~0125825

I only know that in 2015, that messagebox was ok in Cudatext... now it's not.

Anton Kavalenka

2020-09-24 18:26

reporter   ~0125827

Last edited: 2020-09-25 09:25

View 2 revisions

Should be fixed in the same way as GTK3 using https://developer.gnome.org/gtk2/stable/GtkMessageDialog.html#gtk-message-dialog-get-message-area
but I can not make a clue where the gtk_message_dialog_get_message_area() should be declared

Zeljan Rikalo

2020-09-25 10:51

developer   ~0125836

@CudaTextman_, latest gtk2 (2.24 think) uses html rendering inside message boxes by default. So, that should be disabled somehow inside gtk2 or use some htmlescape function from fpc before setting text to gtk2 dialogs.

Anton Kavalenka

2020-09-25 15:03

reporter   ~0125850

I told - the problem EXACTLY the same as GTK3.
The patch attached fixes the problem.
Please relocate the import of gtk_message_dialog_get_message_area() into appropriate place.
gtk2askuser.diff (1,432 bytes)   
Index: lcl/interfaces/gtk2/gtk2lclintf.inc
===================================================================
--- lcl/interfaces/gtk2/gtk2lclintf.inc	(revision 63907)
+++ lcl/interfaces/gtk2/gtk2lclintf.inc	(working copy)
@@ -869,6 +869,30 @@
   Result := False;
 end;
 
+
+function gtk_message_dialog_get_message_area(Dialog:PGtkMessageDialog):PGtkWidget; cdecl; external gtklib;
+
+procedure set_message_text(Dialog:PGtkMessageDialog;const msg: string;const is_pango_markup:boolean=false);
+var
+  ma:PGtkWidget;
+  mainList,ChildList:PgList;
+begin
+  if is_pango_markup then
+    gtk_message_dialog_set_markup(Dialog, PGChar(msg))
+  else
+  begin
+    ma:=gtk_message_dialog_get_message_area(Dialog);
+    MainList := gtk_container_get_children(PGtkContainer(ma));
+    if Assigned(MainList) then
+    begin
+      gtk_label_set_label(PGtkLabel(MainList^.data),PGChar(msg));
+      g_list_free(MainList);
+    end;
+
+  end;
+end;
+
+
 function TGtk2WidgetSet.AskUser(const DialogCaption, DialogMessage: string; DialogType:
   LongInt; Buttons: TDialogButtons; HelpCtx: Longint): LongInt;
 
@@ -997,7 +1021,7 @@
     GTK_DIALOG_MODAL, GtkDialogType, Btns,
      nil);
 
-  gtk_message_dialog_set_markup(PGtkMessageDialog(Dialog), PGChar(DialogMessage));
+  set_message_text(PGtkMessageDialog(Dialog), PGChar(DialogMessage));
 
   g_signal_connect(PGtkObject(Dialog), 'delete-event',
     TGtkSignalFunc(@PromptUserBoxClosed),
gtk2askuser.diff (1,432 bytes)   

Anton Kavalenka

2020-09-25 15:16

reporter   ~0125851

sorry,
set_message_text(PGtkMessageDialog(Dialog), DialogMessage);

Anton Kavalenka

2020-09-25 15:18

reporter   ~0125853

Last edited: 2020-09-27 16:57

View 2 revisions

!ping @Juha Manninen

Juha Manninen

2020-09-27 18:34

developer   ~0125903

Applied, thanks.

Issue History

Date Modified Username Field Change
2020-09-24 00:57 CudaText man_ New Issue
2020-09-24 00:57 CudaText man_ File Added: err.png
2020-09-24 00:57 CudaText man_ File Added: caption.zip
2020-09-24 17:15 Juha Manninen Relationship added related to 0037804
2020-09-24 17:16 Juha Manninen Note Added: 0125824
2020-09-24 17:34 CudaText man_ Note Added: 0125825
2020-09-24 18:26 Anton Kavalenka Note Added: 0125827
2020-09-25 09:25 Anton Kavalenka Note Edited: 0125827 View Revisions
2020-09-25 10:51 Zeljan Rikalo Note Added: 0125836
2020-09-25 15:03 Anton Kavalenka Note Added: 0125850
2020-09-25 15:03 Anton Kavalenka File Added: gtk2askuser.diff
2020-09-25 15:16 Anton Kavalenka Note Added: 0125851
2020-09-25 15:18 Anton Kavalenka Note Added: 0125853
2020-09-27 16:57 Anton Kavalenka Note Edited: 0125853 View Revisions
2020-09-27 18:22 Juha Manninen Assigned To => Juha Manninen
2020-09-27 18:22 Juha Manninen Status new => assigned
2020-09-27 18:34 Juha Manninen Status assigned => resolved
2020-09-27 18:34 Juha Manninen Resolution open => fixed
2020-09-27 18:34 Juha Manninen Fixed in Revision => r63927
2020-09-27 18:34 Juha Manninen LazTarget => -
2020-09-27 18:34 Juha Manninen Widgetset GTK 2 => GTK 2
2020-09-27 18:34 Juha Manninen Note Added: 0125903
2020-10-05 13:39 CudaText man_ Status resolved => closed