Menu

#86 Search Path dialog is broken in dark theme

Closed
closed-fixed
darktheme (1)
5
2019-11-24
2018-11-01
No

The Path Settings dialog is damaged when using IDE's dark theme (see attached screenshots). Furthermore resizing isn't possible. Closing dialog only via "Cancel".

2 Attachments

Discussion

  • Thomas Mueller

    Thomas Mueller - 2018-11-04
    • Group: Closed --> New
     
  • Thomas Mueller

    Thomas Mueller - 2018-11-04

    This happens only if the listbox has a vertical scrollbar. It seems to be a drawing problem with theeming since both visible scroll bars are reflecting the position in the listview, so it's probably only one that is drawn twice. The left one is not functional, clicking on it select text in the memo or a line in the list view. It also does not move when the dialog is resized. When making the dialog wider while the list view is visible, the right scroll bar is not themed properly. So that's definitely a drawing issue. But all this does not happen if the GExperts enhancements for this dialog are disabled.

    This is not restricted to the dark theme, it happens for any themed display, just not for the light "theme", since that one is not themed at all.

    Resizing sometimes works and sometimes doesn't, no idea why. If resizing doesn't work, it's also impossible to move the dialog and the close button in the title also doesn't work. This might be a separate issue.

    (btw: The dialog has a bug itself: The "Greyed items denote invalid path." label is anchored left and right and will get too narrow when the dialog is made narrower. In the dialog's narrowest size, the label has a negative width.)

    I'm at a loss what causes this and how it could be fixed. Maybe GExperts could detect whether theming is active and in that case disable this improvement. But that's not really a good solution.

     
  • Thomas Mueller

    Thomas Mueller - 2018-11-04
    • summary: Dialog is broken in dark theme --> Search Path dialog is broken in dark theme
     
  • Thomas Mueller

    Thomas Mueller - 2018-11-04

    There are some more odd things happening in themed displays: The GExperts extensions to the dialog are not being added at all sometimes, even though they are enabled. In that case moving and resizing the dialog doesn't work either. Turning the extensions off doesn't resolve this problem, the dialog can still not be moved or resized and the Windows close button also does not work.

    (This happend with a custom theme.)

     
  • Achim Kalwa

    Achim Kalwa - 2018-11-04

    I can reproduce this with 10.2.3 with dark theme and the "Browsing path": The dialog can't be resized and can only be closed with the "Cancel" button. But when I use Ctrl-Space to open the system-menu and click "resize" or "move", the dialog can be resized and moved. And after that the form's borders and red close button works again.
    I've changed TGExpertsSettings.LoadForm() to this one, which seems to fix the resize problem (but not the Listbox scrollbar);

    procedure TGExpertsSettings.LoadForm(Form: TCustomForm; const Section: string; FormSaveFlags: TFormSaveFlags);
    var
      StorageSection: string;
      PosChanged    : Boolean;
      SizeChanged   : Boolean;
      R             : TRect;
    begin
      if Section = '' then
        StorageSection := Form.ClassName
      else
        StorageSection := Section;
    
      R := Form.BoundsRect;
      PosChanged := False;
      SizeChanged := False;
    
      if (fsPosition in FormSaveFlags) and ValueExists(StorageSection, 'Left') then
      begin
        R.Left := ReadInteger(StorageSection, 'Left', Form.Left);
        R.Top := ReadInteger(StorageSection, 'Top', Form.Top);
        PosChanged := True;
      end;
    
      if (fsSize in FormSaveFlags) and ValueExists(StorageSection, 'Width') then
      begin
        R.Width  := ReadInteger(StorageSection, 'Width', Form.Width);
        R.Height := ReadInteger(StorageSection, 'Height', Form.Height);
        SizeChanged := True;
      end;
    
      if PosChanged or SizeChanged then
        Form.SetBounds(R.Left, R.Top, R.Width, R.Height)
      else
        CenterForm(Form);
    end;
    
     
    • Thomas Mueller

      Thomas Mueller - 2018-11-11

      Unfortunately that change doesn't solve the problem. It just happened to me again (with the new code), after several tries where it worked fine. Even Ctrl+Space did not work.

      I think there is a timing issue. The form has not been shown yet and gets changed while something in the theming engine is already active and not being updated correctly.
      (The dead scroll bar is probably a symtpom of the same issue.)

      Also, if only the form size is being changed, it should still be centered. But if I add code for that, the form becomes un-movable and un-sizeable every single time (Hey, I can now reliably reproduce the problem, isn't that great?)

       
      • Thomas Mueller

        Thomas Mueller - 2018-11-11

        Yeah, right. Wouldn't reproducing the problem reliably have been great? You can't have that, that would have been too simple. :-(

         
  • Thomas Mueller

    Thomas Mueller - 2018-11-11

    Sending WM_SETREDRAW (false) before and WM_SETREDRAW (true) + RedrawWindow after the changes resolves the rewdrawing issue with the fake scrollbar. It causes some flicker though:

    SendMessage(Form.Handle, WM_SETREDRAW, WParam(False), 0);
    // make all changes
    SendMessage(Form.Handle, WM_SETREDRAW, WParam(True), 0);
    RedrawWindow(Form.Handle, nil, 0, RDW_FRAME or RDW_INVALIDATE or RDW_ALLCHILDREN);
    

    It does not solve the unmovable/unresizable issue.

     
  • Thomas Mueller

    Thomas Mueller - 2018-11-11

    When the unmovable/unresizeable problem occurs, there is a certain position to the right of the list box where the mouse coursor changes to the one for changing the height of the window. When clicking there, it is possible to change the height of the window as if it was the top edge of the window. Once that has been done, normal moving / resizing works again. It looks as if the drawn window does not conform to the window for the mouse control. My guess would be that this position is where the top edge of the window would have been had it not been moved to a new position.

     
  • Thomas Mueller

    Thomas Mueller - 2018-11-11
    • status: open --> closed-fixed
    • Group: New --> Closed
     
  • Thomas Mueller

    Thomas Mueller - 2018-11-11

    Added workarounds for both issues in revision 2433. Needs testing.

     
  • Thomas Mueller

    Thomas Mueller - 2019-11-24
    • status: closed-fixed --> open
    • Group: Closed --> Retest
     
  • Thomas Mueller

    Thomas Mueller - 2019-11-24
    • status: open --> closed-fixed
    • Group: Retest --> Closed
     
  • Thomas Mueller

    Thomas Mueller - 2019-11-24

    Yet again fixed in revision #2879

     

Log in to post a comment.

MongoDB Logo MongoDB