Print Page | Close Window

how to set focus to a field

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=23464
Printed Date: 20 August 2019 at 8:11am


Topic: how to set focus to a field
Posted By: vjedlicka
Subject: how to set focus to a field
Date 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 18.5.0
VS2010, Windows 10



Replies:
Posted By: olebed
Date 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


Posted By: vjedlicka
Date Posted: 13 October 2017 at 9:18am
It works,
Thanks
Vaclav




Print Page | Close Window