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
Groupie
Groupie


Joined: 04 September 2007
Status: Offline
Points: 88
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 16.2.5
VS2010, Windows 8.1
Back to Top
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 627
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
Groupie
Groupie


Joined: 04 September 2007
Status: Offline
Points: 88
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



This page was generated in 0.125 seconds.