mbColorLib TmbDeskPickerButton returning wrong color. [With Suggested Fix] lazarus / 31-LCL ---------------------------------------------------------------------- d-_-b · 2019-08-14 22:49 Hi, Someone in irc reported an issue with the mbColorLib TmbDeskPickerButton returning the wrong color on Windows. Eg, you select black(0) and it returns 65793(RGB: 010101). I debugged the problem and realised `TScreenForm` with a `AlphaBlendValue := 1` affects the `ScreenWin.GetDesktopColor` method. Setting `TScreenForm.AlphaBlendValue := 0` does not work because this "hide" the window so no selection can take place. Also calling `TScreenForm.Hide`, then `GetDesktopColor`, and then `TScreenForm.Show` creates a lot of flickering on screen. So I then decided to rename `ScreenWin.GetDesktopColor` to `ScreenWin.GetScreenColor` and add a private method to `TScreenForm` as follow and that seems to do the trick: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TScreenForm.GetDesktopColor(const X, Y: Integer): TColor;begin  {$IFDEF MSWINDOWS}  AlphaBlendValue:= 0;  {$ENDIF}  Result := GetScreenColor(X, Y);  {$IFDEF MSWINDOWS}  AlphaBlendValue:= 1;  {$ENDIF}end; I don't have the lcl components source code checked out on my machine so I just modified mbColorLib I sourced from OPM. But I think we need to be aware of the problem and hopefully apply my suggested fix to it, after someone also confirms this was the issue. Hence this post, Thanks. edit: added OS Target switch to suggested change to only affect Windows Platforms. ---------------------------------------------------------------------- jamie · 2019-08-14 23:59 if you are doing direct screen reading, RGB values in some cases are backwards. I don't know what else to tell you. ---------------------------------------------------------------------- d-_-b · 2019-08-15 02:40 Quote from: jamie on August 15, 2019, 01:59:14 amI don't know what else to tell you. Have a look at a visual demo of the problem and my solution linked to a TCheckBox to enable/disable the bug. You will see on the first selection the black return as 010101(due to TScreenForm) and the second selection as 000000 because I change AlphaBlendValue := 0 as suggested. ---------------------------------------------------------------------- wp · 2019-08-15 10:29 Applied your fix, thank you. In addition, I use a temporary bitmap now which seems to be essential for Linux qt because otherwise the colorpicker always reports white (25,255,255) there. Please test. ---------------------------------------------------------------------- d-_-b · 2019-08-19 14:41 wp thanks for the quick fix! The user tested and seems happy. I have another suggestion, when I look at the code to show the form I saw it only takes the primary screen width and height into account. Should that not be changed to: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TScreenForm.FormShow(Sender: TObject);begin  Width := Screen.DesktopWidth;  Height := Screen.DesktopHeight;  Left := Screen.DesktopLeft;  Top := Screen.DesktopTop;end; to cover the whole desktop area? ---------------------------------------------------------------------- wp · 2019-08-19 16:07 Done. I cannot test with multiple monitors. Please test yourself and report back.