Print Page | Close Window

CXTPPropertyGridInplaceEdit select all?

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=14494
Printed Date: 27 September 2024 at 6:31pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPPropertyGridInplaceEdit select all?
Posted By: cheez0r
Subject: CXTPPropertyGridInplaceEdit select all?
Date Posted: 10 June 2009 at 2:08pm
Hello,

We have a propertygrid that creates inplace edit items when you click on one of the fields to edit the text. This works all great and fine, except that when the user clicks on one of cells, they'd like it to automatically select all the text in the field for ease of editting, rather than having to manually select it themselves. Sounds simple enough...

But no matter where I"m putting the SetSel(0, -1), something later on is overridding that, and unhighlighting the text (I can even see it highlight the text if I put breakpoints right after my SetSel). I've been at it for a few days and can't figure out where in code it would undo this.

Any help?



Replies:
Posted By: znakeeye
Date Posted: 06 August 2009 at 8:55am
Not sure if this will help (I'm guessing now), but try changing the style of the edit control:
 


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: dennisV
Date Posted: 15 December 2009 at 1:42am
I have the same issue - did you get it solved?

BTW, changing the style doesn't seem to work, at least like so:

((CXTPPropertyGridItem*)pItem)->SetEditStyle(WS_CHILD | ES_AUTOHSCROLL | ES_NOHIDESEL);


-------------
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)


Posted By: dennisV
Date Posted: 31 January 2010 at 4:03pm
This has been solved through support (Mark Doubson). The way it can be done is like this:

BOOL CXTPPropertyGridItem::OnLButtonDown(UINT nFlags, CPoint point)
{
if ((m_nFlags & xtpGridItemHasEdit) && PtInValueRect(point))
{
mouse_event(GetSystemMetrics(SM_SWAPBUTTON) ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
return FALSE; //dirty way to select all on one click
}

return TRUE;
}
Also, to enable selection when you click on the left side of the item (the item name) or when you use the keyboard to navigate:

LRESULT CPropertyGridDlg::OnGridNotify(WPARAM wParam, LPARAM lParam)
{
if (wParam == XTP_PGN_SELECTION_CHANGED)
{
CXTPPropertyGridItem* pItem = (CXTPPropertyGridItem*)lParam;
if (pItem)
{
if (pItem->IsKindOf(RUNTIME_CLASS(CXTPPropertyGridItemNumber)))
{
CXTPPropertyGridItemNumber* pItemNumber = (CXTPPropertyGridItemNumber*) pItem;
if (pItemNumber->GetInplaceEdit().GetSafeHwnd() != NULL)
{
pItemNumber->GetInplaceEdit().SetSel(0, -1);
pItemNumber->GetInplaceEdit().SetFocus();
}
}
}
}



-------------
// W7 64 Ultimate SP1
// VS 2008
// CodeJock 16.2.3 (MFC)



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