URL highlighting in CXTPPropertyGridItem |
Post Reply |
Author | |
ericchubb
Groupie Joined: 31 May 2010 Location: Ireland Status: Offline Points: 15 |
Post Options
Thanks(0)
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
|
|
dleibold
Groupie Joined: 08 March 2010 Location: Canada Status: Offline Points: 13 |
Post Options
Thanks(0)
|
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).
|
|
ericchubb
Groupie Joined: 31 May 2010 Location: Ireland Status: Offline Points: 15 |
Post Options
Thanks(0)
|
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
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |