Click here to Skip to main content
15,881,882 members
Articles / Desktop Programming / MFC

Subselection Dialog

Rate me:
Please Sign up or sign in to vote.
3.17/5 (3 votes)
17 Nov 19992 min read 52.1K   1.6K   22  
Subselection dialog.
//    Project     : any                                                       
//    Customer    : intern                                               
//    Plattform   : WINDOWS 32bit                                            
//    File        : SubSelectionDlg.h                                                       
//    Programmer  : dz, Softtoys                                    
//    Copyright   : Public Domain                                          
//    Contact     : softtoys@webshuttle.ch                                       
//    Description : Class for selection and ordering subsets
//    History     : 01.09.1998                                                    

#ifndef AFX_SUBSELECTIONDLG_H__C369BCB1_52CA_11D2_AA4E_0000E818075B__INCLUDED_
#define AFX_SUBSELECTIONDLG_H__C369BCB1_52CA_11D2_AA4E_0000E818075B__INCLUDED_

// SubSelectionDlg.h : Header-Datei
//
#include "resource.h" 

#define SELDLG_INSERT_AFTER 	0 
#define SELDLG_INSERT_BEFORE	1
#define SELDLG_INSERT_AT_END	2
 
/////////////////////////////////////////////////////////////////////////////
// Dialogfeld CSubSelectionDlg 

class CSubSelectionDlg : public CDialog
{
// Construction
public:
	int Include(int nSel);
	virtual void InitListBox2();
	virtual void InitListBox1();
	CSubSelectionDlg(UINT idd, UINT ListBox1ID, UINT ListBox2ID, CWnd* pParent = NULL);   // Standard constructor

	inline void SetAttributes(BOOL bShowAll = TRUE, int nInsertPos = SELDLG_INSERT_AFTER)
					{ m_bShowAll = bShowAll; m_nInsertPos = nInsertPos; };
	// set to true if the origin selection list (list1) has to show all
	// items at all time (e.g the already selected items too)


// Dialogfelddaten
	//{{AFX_DATA(CSubSelectionDlg)
	enum { IDD = IDD_SELECTDLG };
	//}}AFX_DATA

	CListBox*	m_pSelectionList1;
	CListBox*	m_pSelectionList2;


// �berschreibungen
	// Vom Klassen-Assistenten generierte virtuelle Funktions�berschreibungen
	//{{AFX_VIRTUAL(CSubSelectionDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV-Unterst�tzung
	//}}AFX_VIRTUAL

// Implementierung
protected:
	int m_nInsertPos;

	int getLastSelectedItem(CListBox* p);
	int getFirstSelectedItem(CListBox * p);

	BOOL m_bShowAll; // when TRUE the origin box is not reduced by the selected items but 
	                 // always contains ALL items
	int m_nLastDeletedItem;

	UINT m_nListBox1ID;
	UINT m_nListBox2ID;

	// Generierte Nachrichtenzuordnungsfunktionen
	//{{AFX_MSG(CSubSelectionDlg)
	afx_msg void OnExclude();
	afx_msg void OnInclude();
	afx_msg void OnMovedown();
	afx_msg void OnMoveup();
	afx_msg void OnSelectAll();
	afx_msg void OnDblclkSelectionList1();
	afx_msg void OnDblclkSelectionList2();
	virtual BOOL OnInitDialog();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio f�gt zus�tzliche Deklarationen unmittelbar vor der vorhergehenden Zeile ein.

#endif // AFX_SUBSELECTIONDLG_H__C369BCB1_52CA_11D2_AA4E_0000E818075B__INCLUDED_

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Chief Technology Officer
Switzerland Switzerland
Professional IT developer since 1983. First projects with Cobol, then Pascal, Modula2, C and since Visual C++ 1.0 also with C++ and today C#. Works since 1986 as Consultant, between 1990 and 2008 for Infobrain in Switzerland, from 2008 until 2013 for enValue (also Switzerland) and currently working for Comfone (Bern, Switzerland).

Married, two grown-up daughters, Hobbies : Paragliding, Orienteering, Mountainbiking, Photography

Comments and Discussions