CDialogBar and Listbox
Posted on 2000-04-04
I created my own class derived from CDialogBar. I added a listbox to the dialog bar and I was successful in docking my dialog bar with the list box and it displays fine. (Most of this was done by the wizard - I just added the listbox and created a member variable for it). My problem is that I cannot load any items into the list box. So far, I was able to create a function in my CMainFrame class (MDI application) and used the ON_COMMAND_UPDATE_UI macro - using this, I was able to put items in the list box by calling AddString. The only problem with this is that this routine continually runs while the program is idle and this doesn't seem to be the best way to load items into the listbox. I can stop it by putting in a counter and preventing it from loading additional strings once it reaches a certain point, but then it is always checking it. Is there any way I can do this that will be more efficient? How can I interact with the listbox on the toolbar as if it was a regular dialog?
FYI: I want to be able to have a listbox on the toolbar with a list of items that can be dragged and dropped onto different windows within the MDI. I need to be able to change the items in the listbox at will, and I need to be able to drag them out from the list and drop them on other controls in other windows/views. I was thinking of changing the CListBox to a CDragListBox, but I'm not sure if this would work. Any insight you can provide on how to accomplish this ultimate goal will be helpful.
P.S. I already looked at the examples on the VC++ CD that put combo boxes on a dialog toolbar - this doesn't help me because the items in the combo box are static and set in the resource editor.