Print Page | Close Window

Property Grid VScroll Notify Message

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


Topic: Property Grid VScroll Notify Message
Posted By: cpede
Subject: Property Grid VScroll Notify Message
Date Posted: 06 April 2016 at 5:13am
I find it useful to have a notification whenever the Property Editor is scrolled vertically.
This way I can ensure that when I update the control the scroll position is kept.

But the Property Editor does not send notification when scrolled. Therefore I added a call to 

SendNotifyMessage(XTP_PGN_USER,13);

last in the functions

CXTPPropertyGridView::OnVScroll

CXTPPropertyGridView::OnScrollControl

Can you make an official notification message, so I don't have to add this every time the XTToolkit changes version.

-cpede


-------------
Product: Xtreme ToolkitPro (20.3.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)



Replies:
Posted By: cpede
Date Posted: 26 September 2016 at 10:30am
Can anyone confirm that this will be added in v17.3?

-cpede


-------------
Product: Xtreme ToolkitPro (20.3.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: cpede
Date Posted: 17 July 2019 at 2:51am
Still not changed in v19 ??

OK, why is this so important? If you have a long Property Grid which requires the vertical scrollbar to be visible, and you change a property value in the lower part of the property grid, it tends to scroll up to the beginning, hiding the property just edited.

I propose the following changes in XTPPropertyGridView.cpp:

void CXTPPropertyGridView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
:
:
:
  {
       CListBox::OnVScroll(nSBCode, nPos, pScrollBar);
       RedrawWindow(0, 0, RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ALLCHILDREN);

       // Added by CPN
       SendNotifyMessage(XTP_PGN_USER, 13);
  }
}

and

LRESULT CXTPPropertyGridView::OnScrollControl()
{
:
:
:
  RedrawWindow(0, 0, RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ALLCHILDREN);

  // Added by CPN
  SendNotifyMessage(XTP_PGN_USER, 13);

  return lResult;
}


-cpede


-------------
Product: Xtreme ToolkitPro (20.3.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: cluster
Date Posted: 19 July 2019 at 4:22pm
Hi cpede,

I have solved this problem like this:

void CPropertyManager::UpdateContent(DWORD dwContentType)
{
    ASSERT(m_wndPropertyGrid.GetSafeHwnd());

    int nTopIndex = -1;
    if (dwContentType == m_dwLastContentType) {
        nTopIndex = m_wndPropertyGrid.GetTopIndex();
    }
    CXTPPropertyGridUpdateContext GridContext;
    m_wndPropertyGrid.BeginUpdate(GridContext, FALSE);

... Do all modifications and updates

    m_wndPropertyGrid.EndUpdate(GridContext);

    if (nTopIndex >= 0)
        m_wndPropertyGrid.SetTopIndex(nTopIndex);        // Verhindert das Scrollen
}

it works perfekt for me....


-------------
Windows 7
Visual Studio 2013
CodeJock 18.6


Posted By: cpede
Date Posted: 23 July 2019 at 5:08am
Thanks for the code idea. I did the same code, and it works great for one element.

But consider the following: You have e.g. 2 elements that you want to show properties for. When you click on the first element the property editor is populated with items. Now the topindex will be at 0. If the item list is long you have to scroll down to look at the last items, and the topindex will change to "X". Then you click on the second element, and the property editor is populated with properties for that element. Now the topindex will be at 0 again, since the number of items are different from the two elements. Now if I change back to the first element the the property editor is populated and the topindex will be at 0 again. In this case I would prefer it to scroll down to topindex "X".

So, I need a way to get notified when the property editor item list is scrolled, and then store the topindex for that element.

-cpede


-------------
Product: Xtreme ToolkitPro (20.3.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)



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