CListCtrl, EnsureVisible and LVS_OWNERDATA style

Hi all,

I have a CListCtrl in a DialogBox.
This CListCtrl has the LVS_OWNERDATA style.

I call the function Ensure visible to show a particular item, and I have two
differents behaviours :
- If I DO NOT click in the ListCtrl, then, it works fine, the list si
scrolled to the correct item
- If I click in the ListCtrl, then, any call to EnsureVisible scrolls the
List to the first item.

Does anybody have an idea to explain what is happening ?
Ask for precisions if necessary.

Thanks in advance,

Dansk


0
dansk (5)
4/15/2004 10:56:54 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
1462 Views

Similar Articles

[PageSpeed] 17

Oh dear... I found it, it was a stupid side effect.
CListCtrl works fine in this case...


"Dansk" <dansk@laouilest.fr> a �crit dans le message de
news:eIbr0htIEHA.2744@TK2MSFTNGP10.phx.gbl...
> Hi all,
>
> I have a CListCtrl in a DialogBox.
> This CListCtrl has the LVS_OWNERDATA style.
>
> I call the function Ensure visible to show a particular item, and I have
two
> differents behaviours :
> - If I DO NOT click in the ListCtrl, then, it works fine, the list si
> scrolled to the correct item
> - If I click in the ListCtrl, then, any call to EnsureVisible scrolls the
> List to the first item.
>
> Does anybody have an idea to explain what is happening ?
> Ask for precisions if necessary.
>
> Thanks in advance,
>
> Dansk
>
>


0
dansk (5)
4/16/2004 11:40:47 AM
Reply:

Similar Artilces:

CListCtrl Header height change??
CListCtrl Header height change?? Is it possible to change the height of a CListCtrl Header.? Thanks Markus ...

Styles and Formatting
I always need to clean up files that have gotten trashed with "junk" styles. Is there a way to delete more than one at a time from the Styles and Formatting menu? ...

applyng a multiple header row across pages in default table style
Hello, I want to set up the default table format on an RTF document that will take the fist 2 rows in my table and repeat them as a header on all the pages the table extends to. so I need to know 2 things 1. how do i edit the default table style 2. is it possible to set the first 2 rows as the header. the data in my table is generated automatically and I don't know in advance how big it will be. thank you 1. Use the Modify Style dialog box to modify a table style in Word. The exact steps depend on your version of Word. 2. As far as I know, this is not possible in...

CTreeCtrl and CListCtrl problem
I use create a single document struct using MFC(explore style).The left of the window is CLeftView class(which inherit CTreeView).The right is CBrowserView which inherit CListView.I want to display the content of a directory in the right(CListview) when user click the item of the ctreectrl. In the LeftViw I add method "void CLeftView::OnClickItem (NMHDR* pNMHDR, LRESULT* pResult)" because I want to know which item be clicked by user. ////////////////Leftview////////////////////// CTreeCtrl& mtree=GetTreeCtrl(); HTREEITEM item=mtree.GetSelectedItem(); data=mtree.GetItemDat...

Problems with CListCtrl
I'm having trouble with a CListCtrl object. I'm trying to automatically set the selected items of the list from my code. I try the following statement: m_List.SetItem (pos, 0, LVIF_STATE, NULL, 0, LVIS_SELECTED, LVIS_SELECTED, 0); The SetItem function returns non-zero, which supposedly means it was successful. However, I don't see any selection showing up. I even called RedrawItem on this list item, but it didn't help either. Anyone know about this? -Eric >I'm having trouble with a CListCtrl object. I'm trying to automatically >set the selected ite...

CDialog
Hi Is it possible to change the window style of a CDialog derived class dynamically ? Which method should be over-ridden ? Thanks. PreCreateWindow. You can't change most of the styles once the dialog is created. There is a constant confusion about this; only some styles, in some controls, can be changed dynamically. Unless otherwise determined, assume that styles cannot be changed dynamically. joe On Tue, 2 Sep 2003 15:44:41 +0530, "SteadySteps" <steadysteps(at)yahoo(dot)com> wrote: >Hi > >Is it possible to change the window style of a CDialog derived ...

Images and Style sheets not found
I'm just in the process of moving my development environment from XP and IIS 6 to Win 7 and IIS 7. I am experiencing a problem with style sheets and images. In the master page I have a link to the style sheet: <link rel="stylesheet" type="text/css" href="Style/Style.css" /> and in the page I have some image controls with links such as this: <asp:ImageButton ID="img" runat="server" ImageURL="~/images/logo.gif" PostBackURL="~/default.aspx" /> On IIS 6 these work OK an the images are displayed...

CListCtrl and sub item editting
Hi, Is it possible to implement CListCtrl sub item editting without creating a custom ctrl? I am using VS2003. TIA Tony >Is it possible to implement CListCtrl sub item editting without creating a >custom ctrl? Tony , There's no built-in support for this, so no, you have to provide some implementation for this. Have a look on sites such as CodeGuru and CodeProject, they'll have examples. Dave Thanks Dave, I've seen examples, I just wasnt sure if I needed my own ctrl. Regards Tony "David Lowndes" <DavidL@example.invalid> wrote in message news:k...

How to add clistctrl into clistctrl?
How to clistctrl into a clistctrl? For example like adding checkbox , combobox, i want to add clistctrl into a clistctrl ...

CListCtrl::InsertItem strange behaviour?
Hi everyone, I have a dialog with a couple of ListCtrl on it. I'm filling them up with information when the dialog initializes. Therefore i have two loops, one for each ListCtrl, on both loops I use the same function to insert the items: myListCtrl1.InsertItem(0, anyString); --- myListCtrl2.InsertItem(0, anyString); The weird thing is : the first loop InsertItem is always inserting the Item on the first position (InsertItem returns a 0 always); displacing the previous inserted item. BUT, the second loop InsertItem is always inserting the item on the last position (InsertItem retu...

icons on 2nd column of a clistctrl
hi, Is it possible to have icons or bitmaps on all of the columns of a clistctrl, not only the 1st column ? thanks, "behzad" <behzadnn@yahoo.com> wrote in message news:#LE9$vvYDHA.2284@TK2MSFTNGP12.phx.gbl... > hi, > Is it possible to have icons or bitmaps on all of the columns of a > clistctrl, not only the 1st column ? Never tried it personally, but according to the LVM_SETITEM documentation... http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/listview/messages/lvm_setitem.asp "In version 4.70 and later, you can se...

Tooltip in CListCtrl
Hi all I have been trying now for a couple of days to figure out a way to display a tooltip over individual items in a CListCtrl. My control is in Report style, and has two columns where the first contains keys, and the second values. Problem is the keys do not have a lot of room, and I would like a tooltip to give a better description of what the key actually refers to. I found an article on Codeguru describing how this could be done, but I did not work for me - my override of CWnd::OnToolHitTest was never called by the framework as the article stated it would... For all I know this article...

Article on showing Windows style error on MS Access Form
I am building an application with several forms. In the BeforeUpdate event for the form, I will run some data validation routines. If there is an error, I would like to display an error control next to each field containing an error (the exclamation point). The user can then hover over the error control and get an explanation of the error. This is similar to how a normal windows application works. Some time ago, I can recall seeing an article that described the exact technique that I want to use, but I can't find it now. Could someone please point me to the article? Many thanks! ...

CListCtrl questions
Hi, I am developping on Pocket pc and smartphone and I have a few questions about CListCtrl in report mode. First how can I know how many items I can display without having a vertical scrollbar? On smartphone we are using keypad to move, so first time when I press down key, the curent selection doesn't move.It's only the second time I press the key that is starts to move. First I thought it was a focus problem but even with the focus, it still the same. I also tried to select the first line first with a setitemstate but same result.any idea ? Last question is once a clistctrl h...

SetItemHeight in CListCtrl
Is there a way for me to set the height of all the items in a CListCtrl? I am trying to overlay one of the columns in an item with a CComboxBox and the minimum height in the comboBox appears to be greater than the height of the item in the CListCtrl. Brian Westcott wrote: > Is there a way for me to set the height of all the items in a CListCtrl? I > am trying to overlay one of the columns in an item with a CComboxBox and the > minimum height in the comboBox appears to be greater than the height of the > item in the CListCtrl. > > You have to create OWNERDRAW CLi...

TOC hyperlink styles
I have to create a Word template which contains a table of contents on a purple background and body content on a white background. The table of contents is a list of anchor links and there are links within the body copy. How can I make the two types of links different colours? Ideally I want the links in the body copy to use Word's in-built 'hyperlink' style (which I've customised) and the TOC links to use a custom style (white text for the purple background). I've tried every trick I know of and Google has been of no assistance. Help me please. Hyperlin...

Displaying JPEG images in CListCtrl
Hi All, I am writing an application in which I want to display a set of JPEG images into a CListCtrl. Is there a way of doing this by using just MFC? Awaiting for your reply Thanks & Regards Sachin Bhave > I am writing an application in which I want to display a set of JPEG > images into a CListCtrl. Is there a way of doing this by using just MFC? Try codeguru/codeproject for something like this. Here is one that should get you started: http://www.codeproject.com/listctrl/thumbnailview.asp --- Ajay ...

CListCtrl
I have used LVS_EX_CHECKBOXES extended style for my CListCtrl. Do Parent Window/Dialog receive any notification message when user set/reset the checkbox. I tried to use NM_CLICK , but checkbox value is changed after this notification is processed. ...

How can i set the style of a CTreeCtrl within a CTreeView ?
Im using a MFC CTreeView which fits nicely with what im trying to do. I need to change the style of the nested CTreeCtrl. There is no easy way to do this, the documentation points to using SetWindowLong. void CMyTreeView::OnInitialUpdate() { CTreeView::OnInitialUpdate(); CTreeCtrl& tree = GetTreeCtrl(); HTREEITEM root_item = tree.InsertItem(CString("MyProject")); HTREEITEM init_request = tree.InsertItem(CString("Item 1"), root_item); HTREEITEM doc_package = tree.InsertItem(CString("Item 2"), root_item); ASSERT(tree.GetSafeHwnd() != NULL ); ::Set...

CListCtrl Item Selection Questions
Hi I want to ask several things about CListCtrl here: 1. How to disable multiple item selection? 2. How to disable the column header click? Since I don't have any sorting facility in my application. Thank you very much. Select the ListCtrl object in resource editor and set the following properties Single Selection True No Sort Header True Cheers Check Abdoul --------------------- "Landon" <Landon@discussions.microsoft.com> wrote in message news:589C8584-BE50-4BA0-AA56-58297A072FC3@microsoft.com... > Hi I want to ask severa...

Unable to use CListCtrl.FindItem after CListCtrl.SortItems
I have a CListCtrl which I want to sort, but after I sort I can no longer use FindItem because it always returns a failure. Any assistance with this is greatly appreciated. Thanks! >I have a CListCtrl which I want to sort, but after I sort I can no longer >use FindItem because it always returns a failure. Any assistance with this >is greatly appreciated. Show a concise code example of what you're doing then someone may be able to point out what's wrong. Dave -- MVP VC++ FAQ: http://www.mvps.org/vcfaq LVFINDINFO findinfo; findinfo.flags=LVFI_STRING; findinfo.ps...

Problem with CListCtrl::HitTest
Hi all... I'm programming a Custom Drawn List Control. The problem is when I add a handler for ON_WM_LBUTTONDOWN. This is the code I have in it: void CMyGrid::OnLButtonDown(UINT nFlags, CPoint point) { LVHITTESTINFO ht; ZeroMemory(&ht, sizeof(LVHITTESTINFO)); ht.pt = point; HitTest(&ht); CListCtrl::OnLButtonDown(nFlags, point); } After the call to HitTest, these values are contained in the structure: pt = {x=177 y=179} flags = 1 iItem = -1 iSubitem = 0 regardless I click on an item or not. To know the item and subitem where the click occures, I can use a loop, I think, ...

CListCtrl ?
I was wondering if there is an equivalent statement for the CListCtrl to select a particular? Something like SetCurSel(item number) in a CListBox? What I want is to highlight the insert item and have the list scroll down so that the current item that was inserted is always visible. As it is now the top of the list is always visible. Z.K. You can use SetItemState() and EnsureVisible() to do what you're trying to do. Something like: m_MyList.InsertItem(nItem,_T("New Text For This Item"); m_MyList.SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED); m_MyL...

Creating a CListCtrl
I'm creating a CListCtrl manually to be added to a tabbed window. I have the line: m_listCtrlArtifacts->Create(WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT, CRect(20,20,200,200), &m_outBar, IDGT_PROJ_LIST_ARTIFACTSLIST); MSDN help page - http://msdn2.microsoft.com/en-us/library/zdff988k.aspx - seems like I have all parameters valid, but the problem is that at runtime this gives me an unhandled exception. Any suggestions? > I'm creating a CListCtrl manually to be added to a tabbed window. I have the > line: > > m_listCtrlArtifacts->Create(WS_CHILD|WS_VISIBLE|...

CListCtrl?
Can anyone tell me how to save the items in a CListCtrl to a file and then to load it when the dialog is opened? Thanks in advance I think this already got answered, but this is a new thread so: I would use CStdioFile and simply write the file out as comma separated values like: "Name","Address","Company" or, alternatively, you could store the items in an object list and serialize it to disk if you don't need the file to be readable by outside programs or people. Then, when you want to reload the list control you read and parse the file and write th...