CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2005
    Location
    Bangalore, India
    Posts
    99

    Best display control for displaying 4000 bytes(characters)

    Hello ,
    I am working on SDK.
    Presently my display control is list control.
    display looks like this
    Sln. Time Protocol Tx Data pattern
    1 12:45 UART 1 abc...... MX


    My code snippet(pseudo) is ..
    /******************************************************/
    LVCOLUMN listCol;
    memset(&listCol, 0, sizeof(LVCOLUMN));
    listCol.mask = LVCF_TEXT|LVCF_WIDTH|LVCF_SUBITEM;
    listCol.pszText = "Sl No";
    listCol.cx = 0x28;
    SendMessage(hRxWindow,LVM_INSERTCOLUMN,0,(LPARAM)&listCol);
    ListView_SetItemText(GetDlgItem(hMainDlg,IDC_LIST_RX),nItemCount,1,tempbuf);
    //tempbuf = "abc............z"//4000bytes, no NULL
    /******************************************************/
    The problem is, I have to display 4000 bytes on data column.
    1.How to get this done in GUI with list control?
    2.Any other GUI control required to do this?

    Just basic information is enough.


    Regards
    Nikhil

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Best display control for displaying 4000 bytes(characters)

    I have to display 4000 bytes on data column
    I doubt that... do you really think it's useful to display 4kb of data in a column ?? Also, I don't think a listview allows it.

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Best display control for displaying 4000 bytes(characters)

    For the text limitation, see your other thread: http://www.codeguru.com/forum/showthread.php?t=466602.

    I agree with Skizmo. A list view is not a good idea for what you want to display. My suggestion is that you remove that column from the list view, and add another control (could be a simple edit, or a rich edit, or something custom) to your window. Whenever, the user selects an item in the list view, you populate this second control that data (4000 chars).
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    Join Date
    Aug 2005
    Location
    Bangalore, India
    Posts
    99

    Resolved Re: Best display control for displaying 4000 bytes(characters)

    Hello,
    So this way we solved it !!
    1. We created an edit box(read only)
    2. The data stream that is received from port is directly displayed on edit box as well as list control.
    3. The stream also gets copied into temporary data file, tempfile(HIDDEN, READ ONLY) with encryption.
    4. When user reads n number of streams, always latest stream will be available into edit box.
    5.However if user clicks on any row, corresponding data from tempfile gets copied into edit box.Some co-relation logic.
    6.temp file gets deleted upon application exit.

    Thanks for ur help !!

  5. #5
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Best display control for displaying 4000 bytes(characters)

    But why did you copy that on a temporary file? You can just keep it in memory. You can associate with each list item "data", which is actually a numerical value, and can be a pointer. You can store your 4000 bytes for each item in memory, and associate with the item the pointer to that memory. You only have to make sure, when you clear the list, you iterate through the items and delete that memory.

    See SetItemData() and GetItemData().
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  6. #6
    Join Date
    Aug 2005
    Location
    Bangalore, India
    Posts
    99

    Re: Best display control for displaying 4000 bytes(characters)

    Yah. I thought that initially. The issue pinned is, as the application can run for long, Might not be good idea to keep data volatile.
    Here,even if application crashes data is intact and recoverable.

  7. #7
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Best display control for displaying 4000 bytes(characters)

    OK, I see.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

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