wxPropertyGrid and SetPropertyHelpString

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
simotix
Experienced Solver
Experienced Solver
Posts: 53
Joined: Fri May 29, 2009 5:24 am

wxPropertyGrid and SetPropertyHelpString

Post by simotix » Tue Dec 14, 2010 10:17 pm

I am trying to use the SetPropertyHelpString function, however, I am unsure of where the text will be disabled.

While looking at the documentation it says

"By default, text is shown either in the manager's "description" text box or in the status bar. If extra window style wxPG_EX_HELP_AS_TOOLTIPS is used, then the text will appear as a tooltip. "

However, how can I set up the "manager's "description" text box"?

briceandre
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 670
Joined: Tue Aug 31, 2010 6:22 am
Location: Belgium

Post by briceandre » Wed Dec 15, 2010 6:53 am

You should maybe envisage using wxPropertyGridManager which inherits from wxPropertyGrid. It is supposed to display a a help text box, but I never used it...

simotix
Experienced Solver
Experienced Solver
Posts: 53
Joined: Fri May 29, 2009 5:24 am

Post by simotix » Wed Dec 15, 2010 9:28 am

Hmm, well it seems what gets a description box on a wxProprtyGridManager is "wxPG_DESCRIPTION", however, I do not need all the extra bells and whistles that comes with it. Has anyone ever hooked up a description box to a wxPropertyGrid?

briceandre
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 670
Joined: Tue Aug 31, 2010 6:22 am
Location: Belgium

Post by briceandre » Wed Dec 15, 2010 9:51 am

If you do not want to use wxProprtyGridManager, my comprehension of the doc is that, either you create a status bar and help will be inserted within it, or you create your wxProprtyGrid with style wxPG_EX_HELP_AS_TOOLTIPS and help will be displayed in a tooltip. But, you cannot use the manager's "description" text box, as you are not using the wxProprtyGridManager

jfouche
Super wx Problem Solver
Super wx Problem Solver
Posts: 442
Joined: Tue May 06, 2008 4:52 pm
Location: France

Post by jfouche » Wed Dec 15, 2010 12:04 pm

There is no way to do it directly in wxPropertyGrid. But you can do it by hand, handling the wxEVT_PG_CHANGED event, to show the help string in your custom control :

Code: Select all

Window::Window(...)
{
   ...
   // Create your custom help control
   m_myCustomHelpControl = new ...(this, ...);

   propGrid->Connect(wxEVT_PG_CHANGING, wxPropertyGridEventHandler(Window::OnPropertyChanged), NULL, this);
}

void Window::OnPropertyChanged( wxPropertyGridEvent& event )
{
   wxPGProperty* prop = event.GetProperty();
   m_myCustomHelpControl->SetValue( prop->GetHelpString() );
}
Or you can customize the wxPropertyGridManager to fit your needs (see the available styles).
Jérémie

simotix
Experienced Solver
Experienced Solver
Posts: 53
Joined: Fri May 29, 2009 5:24 am

Post by simotix » Thu Dec 16, 2010 3:08 am

jfouche wrote: Or you can customize the wxPropertyGridManager to fit your needs (see the available styles).
I basically want to strip it down to look exactly like a wxProperyGrid, but since I have to add a page, there is always the page toggle button. I don't see a way to get ride of that button, is there a way to?

jfouche
Super wx Problem Solver
Super wx Problem Solver
Posts: 442
Joined: Tue May 06, 2008 4:52 pm
Location: France

Post by jfouche » Thu Dec 16, 2010 8:24 am

Remove the toolbar...
If you have only one page, you won't have any problems. I personnaly use :

Code: Select all

m_pgmParams = new wxPropertyGridManager(m_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxPGMAN_DEFAULT_STYLE|wxPG_BOLD_MODIFIED|wxPG_DESCRIPTION|wxPG_TOOLTIPS|wxTAB_TRAVERSAL);
Jérémie

Post Reply