Click here to Skip to main content
15,927,745 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: pointer to a function Pin
Tim Smith4-Apr-02 8:08
Tim Smith4-Apr-02 8:08 
GeneralRe: pointer to a function Pin
moredip4-Apr-02 8:24
moredip4-Apr-02 8:24 
GeneralRe: pointer to a member function Pin
Paul M Watt4-Apr-02 8:22
mentorPaul M Watt4-Apr-02 8:22 
GeneralRe: pointer to a function Pin
moredip4-Apr-02 8:31
moredip4-Apr-02 8:31 
GeneralXor function Pin
Mazdak4-Apr-02 5:56
Mazdak4-Apr-02 5:56 
GeneralRe: Xor function Pin
Tomasz Sowinski4-Apr-02 6:01
Tomasz Sowinski4-Apr-02 6:01 
GeneralRe: Xor function Pin
Mazdak4-Apr-02 6:37
Mazdak4-Apr-02 6:37 
GeneralCListCtrl GetSelectionMark() probs Pin
dazinith4-Apr-02 4:47
dazinith4-Apr-02 4:47 
I am having a very frustrating problem, and i'm hoping someone might have some experience with CListCtrl.

Basicly I have a list, and when someone changes their selection i call a function which traces information about the item selected.. this is the code that vc++ .net generated for me, and the 'UpdateButtonStates()' is my function..

// this function is called whenever the user changes the selection on the listctrl
void CCompanyMaint::OnLvnItemchangedComplist(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMLISTVIEW pNMLV = reinterpret_cast<lpnmlistview>(pNMHDR);
UpdateButtonStates(); // change the availability of the buttons based on who is selected
*pResult = 0;
}

so, this calls my function:

void CCompanyMaint::UpdateButtonStates(void)
{
if (m_lstCompanies.GetSelectionMark() != -1)
{
CString strTemp;
int nPos = m_lstCompanies.GetSelectionMark();
int nVal = m_lstCompanies.GetItemData(m_lstCompanies.GetSelectionMark());
strTemp.Format("Position = %i, nVal = %i, name = %s\n", nPos, nVal, m_lstCompanies.GetItemText( m_lstCompanies.GetSelectionMark(), 0));
TRACE(strTemp);
}
}

the problem is that the data which it gets is always the previously selected item, not the currently selected item.. in other words if i choose item 5, then item 1, then it displays item 5's info, when i select a different item then it shows the data for item 1.. its lagged behind one move.. it always shows the data from the item that just got unselected, not the one im currently selecting.. ive tried moving the UpdateButtonStates() function in the OnLvnItemchangedComplist to above and below and in between the generated code.. but it doesn't matter.. any suggestions?

-dz
GeneralRe: CListCtrl GetSelectionMark() probs Pin
dlhson4-Apr-02 4:54
dlhson4-Apr-02 4:54 
GeneralRe: CListCtrl GetSelectionMark() probs Pin
dazinith4-Apr-02 5:03
dazinith4-Apr-02 5:03 
GeneralRe: CListCtrl GetSelectionMark() probs Pin
dazinith4-Apr-02 5:28
dazinith4-Apr-02 5:28 
GeneralRe: CListCtrl GetSelectionMark() probs Pin
Ravi Bhavnani4-Apr-02 6:05
professionalRavi Bhavnani4-Apr-02 6:05 
GeneralRe: CListCtrl GetSelectionMark() probs Pin
dazinith4-Apr-02 6:25
dazinith4-Apr-02 6:25 
GeneralSplit Edit box that's size can be changed Pin
Aoife4-Apr-02 3:47
Aoife4-Apr-02 3:47 
GeneralRe: Split Edit box that's size can be changed Pin
dlhson4-Apr-02 4:48
dlhson4-Apr-02 4:48 
QuestionCombobox read only??? Pin
TommyKnocker4-Apr-02 3:26
TommyKnocker4-Apr-02 3:26 
AnswerRe: Combobox read only??? Pin
Michael P Butler4-Apr-02 3:50
Michael P Butler4-Apr-02 3:50 
AnswerRe: Combobox read only??? Pin
Jon Hulatt4-Apr-02 4:15
Jon Hulatt4-Apr-02 4:15 
AnswerRe: Combobox read only??? Pin
dlhson4-Apr-02 4:33
dlhson4-Apr-02 4:33 
GeneralLogonUser(..) Pin
hph4-Apr-02 3:24
hph4-Apr-02 3:24 
GeneralCode Segment Question Pin
Loli104-Apr-02 2:58
Loli104-Apr-02 2:58 
GeneralRe: Code Segment Question Pin
Niklas L4-Apr-02 3:28
Niklas L4-Apr-02 3:28 
GeneralRe: Code Segment Question Pin
Alvaro Mendez4-Apr-02 8:31
Alvaro Mendez4-Apr-02 8:31 
GeneralRe: Code Segment Question Pin
Derek Waters4-Apr-02 12:49
Derek Waters4-Apr-02 12:49 
GeneralGetFreeSpaceForDrive Pin
Shotgun4-Apr-02 2:53
Shotgun4-Apr-02 2:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.