Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Property Grid
  New Posts New Posts RSS Feed - Property Grid VScroll Notify Message
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Property Grid VScroll Notify Message

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


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 645
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post Topic: Property Grid VScroll Notify Message
    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++)
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 645
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post 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++)
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 645
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post 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++)
Back to Top
cluster View Drop Down
Groupie
Groupie


Joined: 22 January 2015
Status: Offline
Points: 91
Post Options Post Options   Thanks (0) Thanks(0)   Quote cluster Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
cpede View Drop Down
Senior Member
Senior Member


Joined: 13 August 2004
Location: Denmark
Status: Offline
Points: 645
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpede Quote  Post ReplyReply Direct Link To This Post 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++)
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.139 seconds.