Sort list (numeric/text/float/date) using callback

This is a discussion on Sort list (numeric/text/float/date) using callback within the C++ Programming forums, part of the General Programming Boards category; i refer to this guy had an excellent class, but unforturnately i cant get it to work due to ...

  1. #1
    Registered User
    Join Date
    Mar 2004

    Sort list (numeric/text/float/date) using callback

    i refer to

    this guy had an excellent class, but unforturnately i cant get it to work due to compile errors and problems with the variable "m_arrColType"

    forturnately he added a comment to tell us what is "m_arrColType"
    unforturnately i cannot go to the comment page and was booted to the "sitemap" map

    compile error:

    C:\Program Files\Microsoft Visual Studio\xxxxxpg_control_report.cpp(223) : error C2065: 'm_arrColType' : undeclared identifier
    C:\Program Files\Microsoft Visual Studio\MyProjects\xxxxxxpg_control_report.cpp(223) : error C2109: subscript requires array or pointer type
    Error executing cl.exe.

    AClient.exe - 2 error(s), 0 warning(s)

    i tried
    void pg_control_report::OnHeaderClicked(NMHDR* pNMHDR, LRESULT* pResult) 
    	static int  nSortedCol = -1;
    	static bool bSortAscending = true;
    	HD_NOTIFY *phdn = (HD_NOTIFY *) pNMHDR;
    	if( phdn->iButton == 0 )
    		// User clicked on header using left mouse button
    		if( phdn->iItem == nSortedCol )
    			bSortAscending = !bSortAscending;
    			bSortAscending = TRUE;
    		nSortedCol = phdn->iItem;
    		CSortClass csc(this, nSortedCol);
    		long m_arrColType[200];
    		csc.Sort(bSortAscending, (CSortClass::EDataType)
    	*pResult = 0;
    but the code doesnt work

    can anyone please tell me what is "m_arrColType" at the ending of the page?


  2. #2
    Registered User
    Join Date
    Mar 2004
    i still have problems
    // SortClass.h: interface for the CSortClass class.
    #if !defined(AFX_SORTCLASS_H__C4FFD42B_9BC4_4084_AA1C_DAA42CDCC697__INCLUDED_)
    #define AFX_SORTCLASS_H__C4FFD42B_9BC4_4084_AA1C_DAA42CDCC697__INCLUDED_
    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    class CSortClass
    	enum EDataType {dtNULL, dtINT, dtSTRING, dtDATETIME, dtDEC};
    	CSortClass(CListCtrl * _pWnd, const int _iCol);
    	virtual ~CSortClass();
    	void Sort(bool bAsc, EDataType _dtype);
    	CListCtrl * pWnd;
    	 EDataType m_arrColType[200];
    	static int CALLBACK Compare(LPARAM lParam1, LPARAM lParam2, LPARAM
    	struct CSortItem
    		CSortItem(const DWORD _dw, const CString &_txt);
    		DWORD dw;
    		CString txt;
    #endif // !defined(AFX_SORTCLASS_H__C4FFD42B_9BC4_4084_AA1C_DAA42CDCC697__INCLUDED_)
    yes over here u see that i inserted it there

    and included it in my derived CListCtrl class named (pg_control_report)

    // pg_control_report.cpp : implementation file  
    #include "stdafx.h"
    #include "AClient.h"
    #include "pg_control_report.h"
    #include "InPlaceEdit.h"
    #include "SortClass.h"
    #ifdef _DEBUG
    #define new DEBUG_NEW
    #undef THIS_FILE
    static char THIS_FILE[] = __FILE__;
    but still get the same problem :cry:
    something i missed?
    please assist

  3. #3
    Registered User
    Join Date
    Mar 2004

  4. #4
    Join Date
    Mar 2005
    sorry this doesnt answer your question but...
    #if !defined

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Pleas take a look & give a critique
    By sh3rpa in forum C++ Programming
    Replies: 14
    Last Post: 10-19-2007, 11:01 PM
  2. urgent please please..
    By peter_hii in forum C++ Programming
    Replies: 4
    Last Post: 10-30-2006, 06:35 AM
  3. Reverse function for linked list
    By Brigs76 in forum C++ Programming
    Replies: 1
    Last Post: 10-25-2006, 11:01 AM
  4. instantiated from here: errors...
    By advocation in forum C++ Programming
    Replies: 5
    Last Post: 03-27-2005, 09:01 AM
  5. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 11:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21