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: 23 April 2024 at 2:09am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


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 20.1.0
VS2010-2022, Windows 11



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

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net