Solved

CListView Problem

Posted on 1999-01-26
4
203 Views
Last Modified: 2013-11-20
I am trying to use a list view in report style but I cannot get any text to appear under any of my columns?  I know the list control is populated with items ( I've checked the getItemText to be sure), but I can't seem to show the list in report form.  The view seems to know they are there( 'cause the scrollbars are defined)..  

All I am doing is Inserting columns by
cListView.InsertColum(nIndex,"Header",LVCFMT_TEXT,nWidth,0);

Then Inserting Item by
cListView.InsertItem(nIndex,text(nIndex));

All of this is done in the InitialUpdate Procedure...

What Am I missing?
0
Comment
Question by:gpaige
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:atari
ID: 1328344
 // In OnInitialUpdate you must first get a pointer to the CListCtrl in the CListView:
  CListCtrl &m_listctrl=GetListCtrl();

  // Define some columns
  m_listctrl.InsertColumn(0,"1. column",LVCFMT_LEFT,400);
  m_listctrl.InsertColumn(1,"2. column",LVCFMT_LEFT,400);

Bye,
atari
0
 

Author Comment

by:gpaige
ID: 1328345
I have a reference to the listcontrol and my columns are defined... i can see the column headers....
I guess my label was bad -- cListView is defined as
CListCtrl& cListView = GetListCtrl();
0
 
LVL 1

Accepted Solution

by:
atari earned 50 total points
ID: 1328346
Haven't you looked at my above code exactly:

Try this:
m_listctrl.InsertColumn(0,"1. column",LVCFMT_LEFT,400);
m_listctrl.InsertColumn(1,"2. column",LVCFMT_LEFT,400);

Bye,
atari
0
 

Author Comment

by:gpaige
ID: 1328347
I figured it out -- I converted my standard view from the base of CView to CListView -- but neglected to change the base class in all instances - I only changed it in the class constructor
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question