Click here to Skip to main content
15,918,211 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Terminate process Pin
David Crow24-Feb-05 10:25
David Crow24-Feb-05 10:25 
GeneralRe: Terminate process Pin
superstar441024-Feb-05 10:35
susssuperstar441024-Feb-05 10:35 
GeneralRe: Terminate process Pin
David Crow24-Feb-05 10:38
David Crow24-Feb-05 10:38 
GeneralRe: Terminate process Pin
superstar441024-Feb-05 11:00
susssuperstar441024-Feb-05 11:00 
GeneralRe: Terminate process Pin
David Crow24-Feb-05 16:11
David Crow24-Feb-05 16:11 
Generalpopulating a CListCtrl which is inside a Dialog Pin
lino_i24-Feb-05 7:57
lino_i24-Feb-05 7:57 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
David Crow24-Feb-05 8:05
David Crow24-Feb-05 8:05 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
lino_i24-Feb-05 8:15
lino_i24-Feb-05 8:15 
here it is:


the base code for this is from something published by Ben Hill on CTabCtrl applications.
//*View.h
CMyTabCtrl m_tabMyTabCtrl;

In OnInitialUpdate in my *View.cpp

void CTestTabCtrlThreeView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
GetParentFrame()->RecalcLayout();
ResizeParentToFit();

m_tabMyTabCtrl.InsertItem(0, _T("Tab One"));
m_tabMyTabCtrl.InsertItem(1, _T("Tab Two"));

m_tabMyTabCtrl.Init();
}

//Init is a member function of the CMyTabCtrl Class

void CMyTabCtrl::Init(void)
{
m_tabCurrent=0;

m_tabPages[0]->Create(IDD_TAB_ONE, this);
m_tabPages[1]->Create(IDD_TAB_TWO, this);

m_tabPages[0]->ShowWindow(SW_SHOW);
m_tabPages[1]->ShowWindow(SW_HIDE);

SetRectangle();
}

void CMyTabCtrl::SetRectangle(void)
{
CRect tabRect, itemRect;
int nX, nY, nXc, nYc;

GetClientRect(&tabRect);
GetItemRect(0, &itemRect);

nX=itemRect.left;
nY=itemRect.bottom+1;
nXc=tabRect.right-itemRect.left-1;
nYc=tabRect.bottom-nY-1;

m_tabPages[0]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
for(int nCount=1; nCount < m_nNumberOfPages; nCount++)
{
m_tabPages[nCount]->SetWindowPos(&wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
}

//below this point is where my code begins
//here i create a tmp object of type CTabOne which is derived from CDialog
CTabOne tmp;
tmp.Populate();

}

//CTabOne is the dialog box created to work with TabOne of the CTabCtrl
//and it has a data member of type CListCtrl m_TabOneList

void CTabOne::Populate(void)
{
CPersonInfo Person;

m_TabOneList.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
//ListView_SetExtendedListViewStyle(rDest.m_hWnd, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);

//get client rect of list view control
RECT rect;
m_TabOneList.GetClientRect(&rect);

//delete all of the items in teh CListCtrl
//deletes all rows in the CListCtrl before populating
m_TabOneList.DeleteAllItems();

//open CRecordSet
if(Person.IsOpen())
Person.MoveFirst();
else
Person.Open();

//test to see if there are zero columns
if(m_TabOneList.GetHeaderCtrl()->GetItemCount() == 0)
{
//insert column headings
//rDest.InsertColumn(
m_TabOneList.InsertColumn(0, "First", LVCFMT_LEFT, rect.right/2);
m_TabOneList.InsertColumn(1, "Last", LVCFMT_LEFT, rect.right/2);
}

//loop to add rows to listview control
while(Person.IsEOF() == false)
{
//add each row
int row = m_TabOneList.InsertItem(m_TabOneList.GetItemCount(),Person.m_FirstName);
//set next column item
m_TabOneList.SetItemText(row, 1, Person.m_LastName);
//assign the row to an invisible column
m_TabOneList.SetItemData(row, Person.m_ID);
//move to next row
Person.MoveNext();
}
}

void CTabOne::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST1, m_TabOneList);
}

hope this helps.

Thanks for your Help.

Lino
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
David Crow24-Feb-05 8:30
David Crow24-Feb-05 8:30 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
lino_i24-Feb-05 8:40
lino_i24-Feb-05 8:40 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
David Crow24-Feb-05 9:18
David Crow24-Feb-05 9:18 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
Anonymous24-Feb-05 9:22
Anonymous24-Feb-05 9:22 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
David Crow24-Feb-05 9:31
David Crow24-Feb-05 9:31 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
Anonymous24-Feb-05 9:42
Anonymous24-Feb-05 9:42 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
David Crow24-Feb-05 9:53
David Crow24-Feb-05 9:53 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
lino_i24-Feb-05 10:19
lino_i24-Feb-05 10:19 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
David Crow24-Feb-05 10:26
David Crow24-Feb-05 10:26 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
Aamir Butt25-Feb-05 0:45
Aamir Butt25-Feb-05 0:45 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
David Crow25-Feb-05 2:23
David Crow25-Feb-05 2:23 
GeneralRe: populating a CListCtrl which is inside a Dialog Pin
Aamir Butt27-Feb-05 18:07
Aamir Butt27-Feb-05 18:07 
GeneralOwner Draw Menus without MFC Pin
r3dqu33n24-Feb-05 7:53
r3dqu33n24-Feb-05 7:53 
GeneralRe: Owner Draw Menus without MFC Pin
PJ Arends24-Feb-05 16:52
professionalPJ Arends24-Feb-05 16:52 
GeneralReally Tricky situation with ODBC and FlexGrids Pin
ur_unholyness24-Feb-05 6:53
ur_unholyness24-Feb-05 6:53 
GeneralUnicode in CCommandLineInfo Pin
Konrad Windszus24-Feb-05 6:18
Konrad Windszus24-Feb-05 6:18 
GeneralRe: Unicode in CCommandLineInfo Pin
PJ Arends24-Feb-05 8:06
professionalPJ Arends24-Feb-05 8:06 

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.