Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Property Grid
  New Posts New Posts RSS Feed - CXTPPropertyGridInplaceEdit select all?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPPropertyGridInplaceEdit select all?

 Post Reply Post Reply
Author
Message
cheez0r View Drop Down
Newbie
Newbie


Joined: 10 June 2009
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote cheez0r Quote  Post ReplyReply Direct Link To This Post Topic: CXTPPropertyGridInplaceEdit select all?
    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?
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post 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:
 
ES_NOHIDESEL
Negates the default behavior for an edit control. The default behavior hides the selection when the control loses the input focus and inverts the selection when the control receives the input focus. If you specify ES_NOHIDESEL, the selected text is inverted, even if the control does not have the focus.
PokerMemento - http://www.pokermemento.com/
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
dennisV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 October 2004
Location: Australia
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote dennisV Quote  Post ReplyReply Direct Link To This Post 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)
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.188 seconds.