wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.33k stars 515 forks source link

PropertyGrid, SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) broken #1789

Open notgiven688 opened 4 years ago

notgiven688 commented 4 years ago

Python 3.8.2 '4.1.1a1.dev4941+bfb33567 gtk3 (phoenix) wxWidgets 3.1.4'

Minimal example:

import wx
import wx.propgrid as wxpg

class MainFrame(wx.Frame):

    def __init__(self):

        wx.Frame.__init__(self,None)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.sizer)

        pg = wxpg.PropertyGrid(self,size=(100,100))

        cat = pg.Append(wxpg.PropertyCategory("test"))
        pg.AppendIn(cat, wxpg.IntProperty("Property1","P1"))
        pg.AppendIn(cat, wxpg.IntProperty("Property2","P2"))

        # THIS LINE CAUSES TROUBLE
        pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS)

        self.sizer.Add(pg,0,wx.EXPAND)

app = wx.App()
MainFrame().Show(True)
app.MainLoop()

Calling pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) messes up the control, as seen in the screenshots below:

working broken

This problem is not present in earlier versions. In my tests it nicely works with '4.1.0 gtk3 (phoenix) wxWidgets 3.1.4'.

notgiven688 commented 4 years ago

pg.SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS | wxpg.PG_EX_NATIVE_DOUBLE_BUFFERING) Seems to fix it.

swt2c commented 4 years ago

Yes, calling SetExtraStyle(wxpg.PG_EX_HELP_AS_TOOLTIPS) overwrites any existing (default) styles, so it's probably better to do it like this: https://github.com/wxWidgets/Phoenix/blob/master/demo/PropertyGrid.py#L681

There was a bug with PropertyGrid in wxWidgets when native double buffering was disabled, on HiDPI screens. I think it's fixed now but the wxWidgets commit needs to be updated.