Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Problem with Undo/Redo listbox when using pCmdItem->StateSetUndoRedo(); Collapse All
Subject Author Date
Stan Miasnikov May 3, 2007 - 11:56 AM

Hi,

The list box in Undo/Redo toolbar button behaves strange, for some reason the multiple selection is used, which makes it not intuitive to users. I don’t really understand what was a reasoning to make the selection to work the way it does, but I am sure that this is more confusing to a user than helpful. Can you change it to the single selection or may be add an option that would allow to change the list box style in the next version... I tried to put the code below in the CMainFrame::OnPopupListBoxInitContent, but it did not help. Or may be you have other suggestions that would allow selecting a single item in this list box.

DWORD dw = wndListBox.GetStyle();
dw &= ~(LBS_MULTIPLESEL | LBS_SORT | LBS_EXTENDEDSEL);
::SetWindowLong( wndListBox.GetSafeHwnd(), GWL_STYLE, dw );

Thanks,

Technical Support May 3, 2007 - 1:44 PM

All the list box menus are owner drawn (although, by default, they look like standard list boxes and you can see the font size selection list box in the StyleEditor sample). The undo/redo list box is similar to that in Visual Studio 2005, Visual Studio .NET and MS Office applications. The actions to be undone or redone are represented as selected items and this is logically correct and more understandable than one selected item which could confuse users about which actions are actually to be undone or redone: actions above or below the selected item.

Stan Miasnikov May 3, 2007 - 10:14 PM

I actually do not use this button for Undo/Redo. The problem is that I could not find the with a divider button which would drop list box, like the combobox button, but without the text field. There is button that drops menu, but I need a list box, so the closes I found in undo/redo button. Unfortunately, I need single selection not multiple. I know I can write my own button, but I was trying to fid a quick way.

Technical Support May 4, 2007 - 12:08 PM

You could use a CExtBarTextFieldButton-derived class where CExtBarTextFieldButton::PaintCompound is overridden:

void CYourBarTextFieldButton::PaintCompound(
	CDC & dc,
	bool bPaintParentChain,
	bool bPaintChildren,
	bool bPaintOneNearestChildrenLevelOnly
	)
{
	ASSERT_VALID( this );
	ASSERT_VALID( GetBar() );

	CExtBarButton::PaintCompound(
		dc,
		bPaintParentChain,
		bPaintChildren,
		bPaintOneNearestChildrenLevelOnly
		);
}
You could also override the OnInplaceControlCreate virtual method and return NULL in it so that the inplace editor cannot be created.