Solved

Adding item to List Ctrl which is made in splitter contrl

Posted on 2006-11-23
6
210 Views
Last Modified: 2013-11-20
I am making a SDI application in that i have used splitter control in that splitter contol i have made a  list control using this code
CListCtrl& lc = GetListCtrl();
lc.ModifyStyle(0,LVS_REPORT);
lc.InsertColumn(0, _T("Name"), LVCFMT_LEFT,50);
LVCOLUMN col;
col.mask = LVCF_FMT | LVCF_TEXT;
col.pszText = _T("Monitor Type");
col.fmt = LVCFMT_LEFT;
lc.InsertColumn(1, &col);
lc.SetColumnWidth(1,150);
lc.InsertColumn(2, _T("Host(Url)"), LVCFMT_LEFT,150);

In my application when i click a toolbar button a dialog box opens up and the user has to fill the value in that dialog boxes columns and when the user will press the save button then those values will be saved in previous list control

Now the prolem is i am calling object of that list ctrl class in my dialog boxes class its giving an error degub assertion failed when i run the program
and when i use dialog variables in list ctrl class it does not add up the values to list ctrl
how to do it

0
Comment
Question by:ddipro
  • 3
  • 3
6 Comments
 
LVL 22

Expert Comment

by:mahesh1402
ID: 18003827
Can you post some code regarding how you are calling object of listctrl class ....
0
 

Author Comment

by:ddipro
ID: 18005850
i making a object of list view class in its own class like this
extern CSplitterWndTestView6 *obj;

assinging it with this pointer
obj= this;

then definig the same pointer in dialog box class
CSplitterWndTestView6 *object;

and then adiing object like this
obj->lc.InsertItem(0,strName);
0
 
LVL 22

Expert Comment

by:mahesh1402
ID: 18006035
and have you traced at which like exactly you are getting assertion failure by debugging or may be by putting messageboxes in between. ?

-MAHESH
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:ddipro
ID: 18006848
ya i have debugged it
its coming at
obj->lc.InserItem(0,strName);
0
 
LVL 22

Accepted Solution

by:
mahesh1402 earned 500 total points
ID: 18008132
I suspect your dialog window and listcontrol is not FULLY created when you are trying to add items to your control..

you may check with IsWindow function if window/control is fully ceated..

like this :

if(IsWindow(obj->lc.m_hWnd))
   obj->lc.InserItem(0,strName);

Otherwise try adding item on some button click and check if you are getting assertion or not...

-MAHESH
0
 

Author Comment

by:ddipro
ID: 18018673
i have added ur line of code
and it never goes inside if statement and secondly i have tried from new button also but the same problem is occuring
0

Featured Post

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
repeatSeparator  java  challenge 13 57
Folder Comparison 12 54
Shell script to login to remote m/c and execute commands 10 78
scoreUp challenge 14 62
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
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.

770 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