View Issue Details

IDProjectCategoryView StatusLast Update
0001062LazarusLCLpublic2013-09-03 12:07
ReporterPhil Hess Assigned ToPaul Ishenin  
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformWin32OSWindows 
Product Version0.9.9 (SVN) 
Fixed in Version0.9.27 (SVN) 
Summary0001062: Doesn't use native look for buttons in MessageDlg
DescriptionThe old-style Delphi green check and red X button glyphs in MessageDlg buttons look bad when the rest of the app's forms use normal looking buttons for OK and Cancel.

Note that this applies to GTK too - looks particularly bad on Mac!

TagsNo tags attached.
Fixed in Revision
LazTarget1.4
WidgetsetGTK, Win32/Win64
Attached Files

Activities

Marc Geldon

2005-09-30 04:03

reporter   ~0001239

Hello. I have to agree. It also looks very bad on Windows. The "problem" is in the include file "promptdialog.inc" (lazarus/lcl/include/). The procedure "TPromptDialog.LayoutDialog" creates TBitBtns. These BitBtns get a "Kind" assigned. For example if you assign the Kind "bkOk" to a BitBtn, it gets the OK glyph, the default property is set to true and so on. So as I saidd, the procedure assign a "Kind" and so the BitBtn gets also his glyph assigned.

There are two things we can do now: clear the glyph or use TButtons.

Then the other question is: are there people out there WHO want TBitBtns and there Glyphs there. Maybe the initial developer of the "TPromptDialog" had an vision or an idea to create a new type of prompt dialog. I don't know.

So I think the Lazarus team has to decide what do to. Another idea would be, that we create a new parameter and the developer can choose if he wants the glyphs or not.

I am definitely AGAINST those glyphs. They are not standard and as you set, they are not a eye candy.

If the Lazarus team would decide to remove the glyphs or to make a new parameter, I would really like to recode this. I just want to be sure, that the code I write is used, so just give me a message.

Vincent Snijders

2005-10-07 15:00

manager   ~0001316

If you want to work on this, write a mail to the mailing list to discuss what you want to do.

Felipe Monteiro de Carvalho

2005-10-18 17:58

developer   ~0001389

You don't have to remove the glyphs completely to solve this. It has already being discussed on the mailing list a proposal to create many different standard glyph sets so that the developer can choose witch one to use.

If someone want's to start implementing I can help.

Felipe Monteiro de Carvalho

2005-10-18 18:07

developer   ~0001390

He will need someone that uses Mac OS to choose for adequate icons to be used as default for this platform, because many people, like me, have no access no Mac machines. You can send the icons and discuss this on the mailing list.

If noone implements this before, I will on my vacations.

Vincent Snijders

2007-06-13 10:37

manager   ~0013173

Carbon and QT are already implemented, I will see, if the win32 part can be implemented.

2007-06-13 15:03

 

win32msgbox.patch (5,181 bytes)   
Index: include/lclintf.inc
===================================================================
--- include/lclintf.inc	(revision 11317)
+++ include/lclintf.inc	(working copy)
@@ -482,22 +482,22 @@
 
 procedure NotifyUser(const DialogMessage : String; DialogType : longint);
 begin
-  PromptUser(DialogMessage, DialogType, [idButtonOK], -1, -1);
+  PromptUser(DialogMessage, DialogType, [idButtonOK], 0, -1);
 end;
 
 procedure NotifyUser(const DialogCaption, DialogMessage : String; DialogType : longint);
 begin
-  PromptUser(DialogCaption, DialogMessage, DialogType, [idButtonOK], -1, -1);
+  PromptUser(DialogCaption, DialogMessage, DialogType, [idButtonOK], 0, -1);
 end;
 
 procedure NotifyUserAtXY(const DialogMessage : String; DialogType : longint; X, Y : Longint);
 begin
-  PromptUserAtXY(DialogMessage, DialogType, [idButtonOK], -1, -1, X, Y);
+  PromptUserAtXY(DialogMessage, DialogType, [idButtonOK], 0, -1, X, Y);
 end;
 
 procedure NotifyUserAtXY(const DialogCaption, DialogMessage : String; DialogType : longint; X, Y : Longint);
 begin
-  PromptUserAtXY(DialogCaption, DialogMessage, DialogType, [idButtonOK], -1, -1, X, Y);
+  PromptUserAtXY(DialogCaption, DialogMessage, DialogType, [idButtonOK], 0, -1, X, Y);
 end;
 
 function PromptUser(const DialogMessage : String; DialogType : longint; Buttons : Array of Longint;
Index: interfaces/win32/win32lclintf.inc
===================================================================
--- interfaces/win32/win32lclintf.inc	(revision 11315)
+++ interfaces/win32/win32lclintf.inc	(working copy)
@@ -397,4 +397,78 @@
     Result := inherited LoadStockPixmap(StockID, Mask);
 end;
 
+function TWin32WidgetSet.PromptUser(const DialogCaption: string;
+  const DialogMessage: string; DialogType: LongInt; Buttons: PLongInt;
+  ButtonCount: LongInt; DefaultIndex: LongInt; EscapeResult: LongInt): LongInt;
+var
+  uType: UINT;
+  Win32MessageBox: Boolean;
+
+  function SetButtonFlags: boolean;
+  var
+    i: integer;
+    MsgButtons: TMsgDlgButtons;
+  begin
+    Result := true;
+    MsgButtons := [];
+    for i := 0 to ButtonCount -1 do
+      case Buttons[i] of
+        idButtonOk : include(MsgButtons, mbOK);
+        idButtonCancel : include(MsgButtons, mbCancel);
+        idButtonYes : include(MsgButtons, mbYes);
+        idButtonNo : include(MsgButtons, mbNo);
+        idButtonHelp : uType := uType or MB_HELP;
+        idButtonAbort : include(MsgButtons, mbAbort);
+        idButtonRetry : include(MsgButtons, mbRetry);
+        idButtonIgnore : include(MsgButtons, mbIgnore);
+      else
+        Result := false;
+        Exit;
+      end;
+
+    if MsgButtons = [mbOK] then
+      uType := uType or MB_OK
+    else if MsgButtons = mbOKCancel then
+      uType := uType or MB_OKCANCEL
+    else if MsgButtons = [mbRetry, mbCancel] then
+      uType := uType or MB_RETRYCANCEL
+    else if MsgButtons = mbYesNo then
+      uType := uType or MB_YESNO
+    else if MsgButtons = mbYesNoCancel then
+      uType := uType or MB_YESNOCANCEL
+    else if MsgButtons = mbAbortRetryIgnore then
+      uType := uType or MB_ABORTRETRYIGNORE
+    else
+      Result := false;
+  end;
+  
+begin
+  Win32MessageBox := true;
+  case DialogType of
+    idDialogBase : uType := 0;
+    idDialogWarning : uType := MB_ICONWARNING;
+    idDialogError : uType := MB_ICONERROR;
+    idDialogInfo : uType := MB_ICONINFORMATION;
+    idDialogConfirm : uType := MB_ICONQUESTION;
+  else
+    Win32MessageBox := false
+  end;
+  
+  case DefaultIndex of
+    0 : uType := uType or MB_DEFBUTTON1;
+    1 : uType := uType or MB_DEFBUTTON2;
+    2 : uType := uType or MB_DEFBUTTON3;
+    3 : uType := uType or MB_DEFBUTTON4;
+  else
+    Win32MessageBox := false
+  end;
+
+  if Win32MessageBox and SetButtonFlags then
+    Result := Windows.MessageBox(FAppHandle, PChar(DialogMessage),
+                                   PChar(DialogCaption), uType)
+  else
+    Result:=inherited PromptUser(DialogCaption, DialogMessage, DialogType,
+      Buttons, ButtonCount, DefaultIndex, EscapeResult);
+end;
+
 //##apiwiz##eps##   // Do not remove, no wizard declaration after this line
Index: interfaces/win32/win32lclintfh.inc
===================================================================
--- interfaces/win32/win32lclintfh.inc	(revision 11315)
+++ interfaces/win32/win32lclintfh.inc	(working copy)
@@ -47,6 +47,14 @@
 function GetListBoxIndexAtY(ListBox: TComponent; y: integer): integer; override;
 function GetListBoxItemRect(ListBox: TComponent; Index: integer; var ARect: TRect): boolean; override;
 
+function PromptUser(const DialogCaption : string;
+                    const DialogMessage : string;
+                          DialogType    : LongInt;
+                          Buttons       : PLongInt;
+                          ButtonCount   : LongInt;
+                          DefaultIndex  : LongInt;
+                          EscapeResult  : LongInt) : LongInt; override;
+
 procedure RemoveEventHandler(var AHandler: PEventHandler); override;
 procedure RemovePipeEventHandler(var AHandler: PPipeEventHandler); override;
 procedure RemoveProcessEventHandler(var AHandler: PProcessEventHandler); override;
win32msgbox.patch (5,181 bytes)   

Zeljan Rikalo

2009-04-22 16:11

developer   ~0026939

This can be closed ?

Vincent Snijders

2009-04-22 16:37

manager   ~0026943

I don't think so. It still does show the custom glyphs.

I don't know if there is a native windows message dialog with bitbtns.

I think this should be discussed on the mailing list, rather than in the bug tracker.

Vincent Snijders

2009-05-06 11:30

manager   ~0027371

Apparently not yet completely fixed.

Paul Ishenin

2009-09-22 10:34

manager   ~0030902

Fixed in 0.9.27:
http://lazarus-dev.blogspot.com/2009/05/changes-with-button-glyphs.html

If something is not fixed then report what should be done more.

Issue History

Date Modified Username Field Change
2005-07-25 13:51 Phil Hess New Issue
2005-07-25 13:51 Phil Hess Widgetset => Win32
2005-07-26 11:11 Vincent Snijders Target => post 1.0
2005-07-26 11:11 Vincent Snijders Widgetset Win32 => GTK, Win32
2005-09-30 04:03 Marc Geldon Note Added: 0001239
2005-10-07 12:58 Marc Geldon Priority normal => high
2005-10-07 15:00 Vincent Snijders Note Added: 0001316
2005-10-18 17:58 Felipe Monteiro de Carvalho Note Added: 0001389
2005-10-18 18:07 Felipe Monteiro de Carvalho Note Added: 0001390
2006-12-02 09:20 Vincent Snijders Status new => acknowledged
2007-06-13 10:08 Paul Ishenin Status acknowledged => assigned
2007-06-13 10:08 Paul Ishenin Assigned To => Paul Ishenin
2007-06-13 10:36 Vincent Snijders Assigned To Paul Ishenin => Vincent Snijders
2007-06-13 10:37 Vincent Snijders Note Added: 0013173
2007-06-13 15:03 Vincent Snijders File Added: win32msgbox.patch
2007-06-19 13:32 Vincent Snijders Assigned To Vincent Snijders =>
2007-06-19 13:33 Vincent Snijders LazTarget post 1.0 => post 1.2
2007-06-19 13:33 Vincent Snijders Status assigned => acknowledged
2008-02-22 09:53 Felipe Monteiro de Carvalho Relationship added related to 0010872
2008-02-22 09:53 Felipe Monteiro de Carvalho Relationship deleted related to 0010872
2009-04-22 16:11 Zeljan Rikalo Note Added: 0026939
2009-04-22 16:37 Vincent Snijders Note Added: 0026943
2009-05-06 11:27 Vincent Snijders Status acknowledged => resolved
2009-05-06 11:27 Vincent Snijders Fixed in Version => 0.9.27 (SVN)
2009-05-06 11:27 Vincent Snijders Resolution open => fixed
2009-05-06 11:27 Vincent Snijders Assigned To => Vincent Snijders
2009-05-06 11:29 Vincent Snijders Assigned To Vincent Snijders =>
2009-05-06 11:29 Vincent Snijders Status resolved => assigned
2009-05-06 11:29 Vincent Snijders Resolution fixed => reopened
2009-05-06 11:30 Vincent Snijders Status assigned => acknowledged
2009-05-06 11:30 Vincent Snijders Note Added: 0027371
2009-05-06 11:30 Vincent Snijders Resolution reopened => open
2009-09-22 10:34 Paul Ishenin Status acknowledged => resolved
2009-09-22 10:34 Paul Ishenin Resolution open => fixed
2009-09-22 10:34 Paul Ishenin Assigned To => Paul Ishenin
2009-09-22 10:34 Paul Ishenin Note Added: 0030902
2011-12-01 11:22 Marc Weustink Status resolved => closed
2013-09-03 12:07 Martin Friebe LazTarget post 1.2 => 1.4