• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 243
  • Last Modified:

Adding item to List Ctrl which is made in splitter contrl

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
ddipro
Asked:
ddipro
  • 3
  • 3
1 Solution
 
mahesh1402Commented:
Can you post some code regarding how you are calling object of listctrl class ....
0
 
ddiproAuthor Commented:
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
 
mahesh1402Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
ddiproAuthor Commented:
ya i have debugged it
its coming at
obj->lc.InserItem(0,strName);
0
 
mahesh1402Commented:
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
 
ddiproAuthor Commented:
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now