Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Property Grid
  New Posts New Posts RSS Feed - how to set focus to a field
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

how to set focus to a field

 Post Reply Post Reply
Author
Message
vjedlicka View Drop Down
Senior Member
Senior Member


Joined: 04 September 2007
Status: Offline
Points: 122
Post Options Post Options   Thanks (0) Thanks(0)   Quote vjedlicka Quote  Post ReplyReply Direct Link To This Post Topic: how to set focus to a field
    Posted: 11 October 2017 at 5:43am
How do I set focus to a text field in a property grid?

This code does not work:

CXTPPropertyGridItem* l_pItem = m_wndPropertyGrid.FindItem(pt_IDS_PROP_WIRE_NAME);
if (l_pItem)
{
l_pItem->SetFocusToInplaceControl();
}


Thank you
Vaclav
---------------------
ToolkitPro 20.1.0
VS2010-2022, Windows 11
Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 11 October 2017 at 8:02am
Hello,

You need call OnSelect() before  SetFocusToInplaceControl(),

However OnSelect() is protected, you need to inherit CXTPPropertyGridItem and add method to public call this method.
    CXTPPropertyGridItem *l_pItem = m_wndPropertyGrid.FindItem(pt_IDS_PROP_WIRE_NAME);
    if (l_pItem)
    {
        l_pItem->OnSelect();
        l_pItem->SetFocusToInplaceControl();
    }

Regards,
 Oleksandr Lebed
Back to Top
vjedlicka View Drop Down
Senior Member
Senior Member


Joined: 04 September 2007
Status: Offline
Points: 122
Post Options Post Options   Thanks (0) Thanks(0)   Quote vjedlicka Quote  Post ReplyReply Direct Link To This Post Posted: 13 October 2017 at 9:18am
It works,
Thanks
Vaclav

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.152 seconds.