wxPropGrid problem Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
frank_frl
Earned some good credits
Earned some good credits
Posts: 139
Joined: Sat Feb 18, 2006 1:41 pm
Location: Germany

wxPropGrid problem

Post by frank_frl » Mon Dec 14, 2009 10:19 am

Hi,

I have a wxDirProperty in my wxPropGrid and want prevent the user from manually change the path in the text control. So I set the property to limited editing with LimitPropertyEditing.
But then the text is only visible when the entry is NOT selected. As soon as I select this entry, the text is disappearing and is shown again when I select an other entry.:(

Do I miss something here?

Frank
WinXp SP3, OS X10.5.5; CodeLite, Dialog::Blocks, wxWidgets 2.8.10

spectrum
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Sat Jul 21, 2007 12:17 pm

Post by spectrum » Mon Dec 14, 2009 2:03 pm

To disable user input, could you try just

pg->DisableProperty ("name");
spectrum

frank_frl
Earned some good credits
Earned some good credits
Posts: 139
Joined: Sat Feb 18, 2006 1:41 pm
Location: Germany

Post by frank_frl » Sat Dec 19, 2009 4:19 pm

spectrum wrote:To disable user input, could you try just

pg->DisableProperty ("name");
This disables the whole property. I fixed it by changing the propgrid sources for my needs so that if wxPG_PROP_READONLY is set, only the text field is read only, but the button is not disabled.

Frank
WinXp SP3, OS X10.5.5; CodeLite, Dialog::Blocks, wxWidgets 2.8.10

GBT
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Dec 10, 2014 4:12 pm

Re: wxPropGrid problem

Post by GBT » Wed Dec 10, 2014 4:24 pm

I am having the same issue where the text is only visible when the entry is NOT selected when using the LimitPropertyEditing function. I am not able to modify propgrid as suggested to disable only the text when wxPG_PROP_READONLY is set.

I have written a wxPGCellRenderer class in an attempt to force the text to remain visible while selected but this has failed. Does anyone have any other ideas?

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2662
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxPropGrid problem

Post by PB » Wed Dec 10, 2014 6:31 pm

If you think there is a bug, fill a bug report on wxWidgets tracker, providing an easy way to reproduce it, ideally with a simple patch to the propgrid sample. Artur Wieczorek has recently fixed a lot of wxPropertyGrid issues, he may fix yours one too.

GBT
In need of some credit
In need of some credit
Posts: 4
Joined: Wed Dec 10, 2014 4:12 pm

Re: wxPropGrid problem

Post by GBT » Thu Dec 11, 2014 4:00 pm

I found out what was happening. The text font was changed to white assuming it would be white text on a blue background when selected. When you use the LimitPropertyEditing function to limit text based editing the text is not selected so the background does not change to blue. So what you end up with is white text on a white background.

In my wxPGCellRenderer render function I have forced the wxDC text foreground color to black.

void VariableTreeRenderer::Render(wxDC &dc, const wxRect &rect, const wxPropertyGrid *propertyGrid, wxPGProperty *property, int column, int item, int flags) const
{
//If the column is 0 then just draw the label
if (column == 0)
dc.DrawLabel(wxString::Format(wxT(" %s"), property->GetLabel().c_str()), rect, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
else
{
wxString sDisplayText = property->GetValueAsString();
sDisplayText.Replace(wxT(","), wxT(", "));

//Force text to be in black even if selected.
dc.SetTextForeground(*wxBLACK);

dc.DrawLabel(sDisplayText, rect, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
}
}

Post Reply