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

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    114

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

    i refer to
    http://www.codeguru.com/Cpp/controls...cle.php/c1055/

    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
    Code:
    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;
    		else
    			bSortAscending = TRUE;
    
    		nSortedCol = phdn->iItem;
    
    		CSortClass csc(this, nSortedCol);
    
    		long m_arrColType[200];
    
    
    		csc.Sort(bSortAscending, (CSortClass::EDataType)
    			m_arrColType[nSortedCol]);
    	}
    	*pResult = 0;
    }
    but the code doesnt work


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



    :wave:

  2. #2
    Registered User
    Join Date
    Mar 2004
    Posts
    114
    i still have problems
    Code:
    // 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
    {
    public:
    	enum EDataType {dtNULL, dtINT, dtSTRING, dtDATETIME, dtDEC};
    
    	CSortClass(CListCtrl * _pWnd, const int _iCol);
    	virtual ~CSortClass();
    	void Sort(bool bAsc, EDataType _dtype);
    
    protected:
    	CListCtrl * pWnd;
    	 EDataType m_arrColType[200];
    
    
    
    	static int CALLBACK Compare(LPARAM lParam1, LPARAM lParam2, LPARAM
    		lParamSort);
    
    	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)

    Code:
    // 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__;
    #endif
    but still get the same problem :cry:
    something i missed?
    please assist

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    114

  4. #4
    *this
    Join Date
    Mar 2005
    Posts
    498
    sorry this doesnt answer your question but...
    Code:
    #if !defined
    ==
    Code:
    #ifndef

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, 10: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, 10: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, 10:21 PM