Passing a control id
-
I have some code which sets the item data on a list box depending on some data attributes. I have multiple list boxes in my application and always want to set the item data the same way. To do this I need to pass as a parameter the control id of the list box in question. That way I can do a listbox.SetItemData (fieldNum, 1); How do I specify the type of listbox in my code? Here is the prototype and code. void DataImportDlg2::SetMapType(CListBox list, LPCTSTR fieldName, int fieldNum) { DbHelper::InputType inputType; DbHelper dbHelper; // Set the additional data flag which indicates whether // the item is a value mapping type or not. 1 indicates it is, // a 0 means no. inputType = dbHelper.GetItemsInputType (fieldName); if (inputType == DbHelper::A) list.SetItemData (fieldNum, 1); else list.SetItemData (fieldNum, 0); } I make the call like this: SetMapType (m_availFieldList, *iter, index); which gives me a compile error 'cannot convert parameter 1 from 'class CListBox' to 'class CListBox' Any ideas on what type to make the list parameter? Thanks in advance, Bob
-
I have some code which sets the item data on a list box depending on some data attributes. I have multiple list boxes in my application and always want to set the item data the same way. To do this I need to pass as a parameter the control id of the list box in question. That way I can do a listbox.SetItemData (fieldNum, 1); How do I specify the type of listbox in my code? Here is the prototype and code. void DataImportDlg2::SetMapType(CListBox list, LPCTSTR fieldName, int fieldNum) { DbHelper::InputType inputType; DbHelper dbHelper; // Set the additional data flag which indicates whether // the item is a value mapping type or not. 1 indicates it is, // a 0 means no. inputType = dbHelper.GetItemsInputType (fieldName); if (inputType == DbHelper::A) list.SetItemData (fieldNum, 1); else list.SetItemData (fieldNum, 0); } I make the call like this: SetMapType (m_availFieldList, *iter, index); which gives me a compile error 'cannot convert parameter 1 from 'class CListBox' to 'class CListBox' Any ideas on what type to make the list parameter? Thanks in advance, Bob
Pass a reference to the list to be updated:
void DataImportDlg2::SetMapType(CListBox**&** list, // note the extra '&'
LPCTSTR fieldName,
int fieldNum)Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
Pass a reference to the list to be updated:
void DataImportDlg2::SetMapType(CListBox**&** list, // note the extra '&'
LPCTSTR fieldName,
int fieldNum)Joaquín M López Muñoz Telefónica, Investigación y Desarrollo