CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: beginner

  1. #1
    Join Date
    Aug 1999
    Posts
    70

    beginner



    code
    m_LISTCTRL.InsertColumn(0,"USER",LVCFMT_LEFT,50,-1);m_LISTCTRL.InsertColumn(1,"DESCRIPTION",LVCFMT_LEFT,100,-1);m_LISTCTRL.InsertColumn(1,"SIZE",LVCFMT_LEFT,100,-1);
    //Item 1
    m_LISTCTRL.InsertItem(1,"razo");m_LISTCTRL.SetItem(1,1,LVIF_TEXT,"abc.doc",0,0,0,NULL);m_LISTCTRL.SetItem(1,2,LVIF_TEXT,"145",0,0,0,NULL);
    style:report
    when I use this I get
    USER DESCRIPTION SIZE
    razo
    I get the same when I changed setitem to setitemtext. Sir I think setitem/setitemtext is not working.what to do
    tufail



  2. #2
    Join Date
    Apr 1999
    Location
    Toronto, ON
    Posts
    713

    Re: beginner

    Hi! It's me again.
    So, try this

    m_LISTCTRL.InsertColumn(0,"USER",LVCFMT_LEFT,50,-1);m_LISTCTRL.InsertColumn(1,"DESCRIPTION",LVCFMT_LEFT,100,-1);m_LISTCTRL.InsertColumn(1,"SIZE",LVCFMT_LEFT,100,-1);
    //Item 1


    m_LISTCTRL.InsertItem(1,"razo");
    m_LISTCTRL.SetItemText(1,1,"abc.doc");
    m_LISTCTRL.SetItemText(1,2,"145");


    Dmitriy, MCSE

  3. #3
    Join Date
    Aug 1999
    Posts
    70

    Re: beginner

    sir,
    what I did is put insertcolumn statments in the onitdialog() functions and the other statments in the mouse click event of the "button". When I first time clicks the button it only displays the "razo" under the first column, but when I again click it , it displays all i.e after two clicks I get

    user description size
    razo

    razo abc.doc 145
    what is the problem.
    tufail


  4. #4
    Join Date
    Apr 1999
    Location
    Toronto, ON
    Posts
    713

    Re: beginner

    Please show your function OnButtonClick()


    Dmitriy, MCSE

  5. #5
    Join Date
    Aug 1999
    Location
    Romania, Bucharest
    Posts
    253

    Re: beginner

    Code:
    void CListcolDlg::OnButton1() 
    {
    if(list.GetItemCount()==0)
    {
    list.InsertColumn(0,"A",LVCFMT_LEFT,50,-1);	
    list.InsertColumn(0,"B",LVCFMT_LEFT,50,-1);
    list.InsertColumn(0,"C",LVCFMT_LEFT,50,-1);
    }
    list.InsertItem(1,"aa");
    list.SetItemText(1,1,"aa.aa");
    list.SetItemText(1,2,"11");
    }
    if i write this code at first push of buton in the list is write only "aa"
    for every push after the first i the list will apear aa aa.aa 11
    how can i do to write all strings at first push


  6. #6
    Join Date
    Apr 1999
    Location
    Toronto, ON
    Posts
    713

    Re: beginner

    Well. I tried it with this code:
    void CListDialog::OnButtonList()
    {
    m_lstGroups.InsertColumn(0,_T("Newsgroups"),LVCFMT_LEFT,30);
    m_lstGroups.InsertColumn(1,_T("TopId"),LVCFMT_LEFT,30);
    m_lstGroups.InsertColumn(2,_T("LowId"),LVCFMT_LEFT,30);
    m_lstGroups.InsertColumn(3,_T("Post"),LVCFMT_LEFT,30);
    m_lstGroups.InsertItem(0,_T("first"));
    m_lstGroups.SetItemText(0,1,_T("second"));
    m_lstGroups.SetItemText(0,2,_T("three"));
    }
    It works.
    So what may be the problem?
    I think - 1) check your styles.
    I have "single selection",
    "no label wrap","show selection always",
    "border", "visible", "tabstop"
    2) what message does handle OnButton1() - is it simple BN_CLICKED? Or it is BN_DOUBLECLICKED?



    Dmitriy, MCSE

  7. #7
    Join Date
    Aug 1999
    Posts
    70

    Re: beginner

    Sir,
    I have selected fullrowselect mode. Sir how to determine which row is selected and what are entries associated with it.
    tufail


  8. #8
    Join Date
    Aug 1999
    Posts
    70

    Re: beginner

    Sir,
    I have selected fullrowselect mode. Sir how to determine which row is selected and what are entries associated with it.How to redraw the list control.
    tufail


  9. #9
    Join Date
    Apr 1999
    Location
    Toronto, ON
    Posts
    713

    Re: beginner

    int iItem = m_LISTCTRL.GetNextItem( -1, LVNI_ALL | LVNI_SELECTED);
    CString strText=m_lstGroups.GetItemText(iItem,0);

    You can put these lines on your NM_CLICK or NM_DBLCLICK handler. (Create handler in ClassWizard)


    Dmitriy, MCSE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured