[SOLVED] Cannot hide buttons in EditListBox |
Post Reply |
Author | ||
docontrol
Groupie Joined: 07 December 2009 Location: Denmark Status: Offline Points: 35 |
Post Options
Thanks(0)
Posted: 06 July 2020 at 6:00am |
|
There seem to be a bug in the source code for the CXTPEditListBox control in 19.2. If I call SetListEditStyle with LBS_XTP_ONLY_UP_DOWN to hide new and delete buttons the application will still try to apply markup to the hidden buttons. I can workaround the bug by manually hiding those buttons after creation, but it seems to me that there is a bug here. What makes me in doubt is the fact the LBS_XTP_ONLY_UP_DOWN is not mentioned in the CodeJock help file regarding the CXTPEditListBox::SetListEditStyle method. Is that also a bug?
The bug mentioned is in XTPEditListBox.cpp on lines 866-869:
Instead of applying the markup for all buttons after the for loop on lines 824-854, I would simply move the code inside the loop and apply it using a switch statement, e.g.:
|
||
agontarenko
Admin Group Joined: 25 March 2016 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
|
Hello, It known bug, and it already fixed. As hotfix you need to replace void CXTPEditListBoxToolBar::Initialize(bool bAutoFont /*= true*/) function in next file C:\Program Files (x86)\Codejock Software\MFC\Xtreme ToolkitPro v19.2.0\Source\Controls\ListBox\XTPEditListBox.cpp with void CXTPEditListBoxToolBar::Initialize(bool bAutoFont /*= true*/) { // Create the ToolTip control. m_tooltip.Create(this); m_tooltip.Activate(TRUE); for (int i = 0; i < _countof(m_arButton); ++i) { if ((!m_bShowNewDeleteButtons) && ((i == 0) || (i == 1))) continue; if ((!m_bShowUpDownButtons) && ((i == 2) || (i == 3))) continue; if (!m_arButton.Create(NULL, WS_CHILD | WS_VISIBLE | BS_ICON | BS_CENTER | BS_VCENTER, CRect(0, 0, 0, 0), this, _arButtonID)) { TRACE0("Unable to create edit button.\n"); continue; } CString strToolTip; CXTPResourceManager::AssertValid( XTPResourceManager()->LoadString(&strToolTip, _arButtonID)); // Add tooltips to group buttons. m_tooltip.AddTool(&m_arButton, strToolTip); // make sure the button is Windows XP theme compatible using // the toolbar button theme. if (m_arButton.SetTheme(xtpControlThemeFlat)) { CXTPButtonTheme* pTheme = m_arButton.GetTheme(); if (pTheme) { pTheme->EnableToolbarStyle(TRUE); } m_arButton.SetUseVisualStyle(TRUE); } m_arButton.EnableMarkup(); } if (m_bShowNewDeleteButtons) { CString xamlAdd, xamlDel; VERIFY(XTPResourceManager()->LoadXAML(xamlAdd, IDR_XAML_ICON_LIST_SYMBOL_ADD)); VERIFY(XTPResourceManager()->LoadXAML(xamlDel, IDR_XAML_ICON_LIST_SYMBOL_DELETE)); GetNewButton().SetWindowText(xamlAdd); GetDeleteButton().SetWindowText(xamlDel); } if (m_bShowUpDownButtons) { CString xamlUp, xamlDown; VERIFY(XTPResourceManager()->LoadXAML(xamlUp, IDR_XAML_ICON_LIST_SYMBOL_ARROW_UP)); VERIFY(XTPResourceManager()->LoadXAML(xamlDown, IDR_XAML_ICON_LIST_SYMBOL_ARROW_DOWN)); GetUpButton().SetWindowText(xamlUp); GetDownButton().SetWindowText(xamlDown); } // Move the buttons to their correct location. MoveButtons(); // Set the font for this window. if (bAutoFont) { SetFont(&XTPAuxData().xtpFont); } } Regards, Artem Gontarenko
|
||
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |