Print Page | Close Window

URL highlighting in CXTPPropertyGridItem

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=19587
Printed Date: 04 December 2024 at 2:43pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: URL highlighting in CXTPPropertyGridItem
Posted By: ericchubb
Subject: URL highlighting in CXTPPropertyGridItem
Date 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



Replies:
Posted By: dleibold
Date 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 - 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).
 


Posted By: ericchubb
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net