Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Property Grid
  New Posts New Posts RSS Feed - URL highlighting in CXTPPropertyGridItem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

URL highlighting in CXTPPropertyGridItem

 Post Reply Post Reply
Author
Message
ericchubb View Drop Down
Groupie
Groupie


Joined: 31 May 2010
Location: Ireland
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote ericchubb Quote  Post ReplyReply Direct Link To This Post Topic: URL highlighting in CXTPPropertyGridItem
    Posted: 20 March 2012 at 12:54pm
Hi there

An application I'm working makes heavy use of subclassed derivatives of CXTPPropertyGrid and CXTPPropertyGridItem objects, and I want the property grid to highlight URIs contained in property grid item text and perform an action such as launching a web browser when a user clicks on them. Is there any way to add text to a property grid item, as a URI, and associating an action with it like launching a browser?

Thanks
Back to Top
dleibold View Drop Down
Groupie
Groupie
Avatar

Joined: 08 March 2010
Location: Canada
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote dleibold Quote  Post ReplyReply Direct Link To This Post Posted: 05 April 2012 at 10:29am
One way to implement hyperlinks in the property grid values is to add a CXTPPropertyGridInplaceButton to the inplace buttons of the CXTPPropertyGridItem (pItem); the inplace button has a SetHyperlink() option, then button caption is set to the URL, something like this:
 
CString strURL = "http://www.codejock.com";
CXTPPropertyGridInplaceButton* pBtn = pItem->GetInplaceButtons()->AddButton(new CXTPPropertyGridInplaceButton(1))
pBtn->SetHyperlink();
pBtn->SetShowAlways(TRUE);
pBtn->SetAlignment(DT_LEFT);
pBtn->SetCaption(strURL);
 
Then handle the notification for XTP_PGN_INPLACEBUTTONDOWN, test for the proper item ID, then add statements to launch a browser with the URL (e.g. from strURL or button caption).
 
Back to Top
ericchubb View Drop Down
Groupie
Groupie


Joined: 31 May 2010
Location: Ireland
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote ericchubb Quote  Post ReplyReply Direct Link To This Post Posted: 17 April 2012 at 6:33am
Hi there

Thanks very much for your suggestion - it turns out we decided to just override OnLButtonDblClk for our CXTPPropertyGridItem-derived class and present a dialog which the user can paste a URL into, then assigning the value to the text in the grid item. Your code may prove very useful for a future feature we have in mind.

Thanks again
Eric
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.250 seconds.