Disableing items in CLIstCtrl

Hello,

    Is there a way to disable an item in CListCtrl so that the item is gray
out and a user won't be able to select it.

Thank You!


0
horvathr (32)
4/15/2005 3:03:17 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
676 Views

Similar Articles

[PageSpeed] 42

At this point I think you have to go to an owner-draw list control and do it yourself. You
also have to prevent the selection from happening.
				joe

On Fri, 15 Apr 2005 11:03:17 -0400, "Ririko Horvath" <horvathr@securemethods.com> wrote:

>Hello,
>
>    Is there a way to disable an item in CListCtrl so that the item is gray
>out and a user won't be able to select it.
>
>Thank You!
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15972)
4/17/2005 3:36:59 AM

Ririko Horvath wrote:
> Hello,
> 
>     Is there a way to disable an item in CListCtrl so that the item is gray
> out and a user won't be able to select it.

You will have to derive from CListCtrl and override DrawItem. There is 
an example of what this entails in the CListBox::DrawItem. There are 
examples all over the web for CListCtrl. You will have to keep track of 
what is enabled yourself, you can use the data member of the item.

You will want to handle LVN_ITEMCHANGING. If you have disabled it, set 
*pResult to 1. This will keep the item from changing to selected. This, 
even if you don't draw it selected, so the selected flag doesn't get set.

Best, Dan.

0
public21 (290)
4/22/2005 6:21:56 PM
Reply:

Similar Artilces:

Outlook 98 e-mails not going to sent items.
This is a weird problem from my behalf, when i send an e-mial no matter to who, the e-mail does not go to the sent items folder. Can anyone help out, thank you. Marcel. ...

Why can't I open e-mails from my new item alert window?
I have alerts pop up when new messages arrive in two of my e-mail accounts. But when I click on an item in the new alert window and click "open item," I get a message indicating the message is no longer available it may have been moved or deleted. But the message is there. In fact, if I go into the inbox and click on the message (just reading it in preview mode or opening it), then I can go back to the new item alert window, click "open item" and the message will open. ...

Disable BU
A really quick one for you. If I disable a BU in MSCRM, does the corresponding OU in Active Directory become disabled? I think the answer probably 'No' as I actually cannot find a way to disable the OU manually and therefore cannot check, but if anyone has a definitive answer I would be grateful. Regards Peter John - thanks for your help. Regards Peter >-----Original Message----- >No, disabling BU in CRM will not disable corresponding OU in the AD, just like dissabling CRM user in CRM will not siable the corrsponding user in AD. > >"Pete" wrote: > &...

Adding Calendar Items via Click
On some web sites such as eVite.com, it is possible to add an item to your Outlook by simply clicking a link. What is the magic file extension that will invoke Outlook? What is the format of the file for the calendar item? I couldn't seem to find the right words to search for in support.microsoft.com. Thanks. those are icalendars and it can be opened in notepad. if you have one of the items downloaded, open it in notepad or select an event in outlook and choose actions, send as icalendar. Save the resulting attachment to disk and open it in notepad. see http://www.imc.org/pdi/ ...

how can disable service with bat file
Hi, Please tell me, how can i disable service with bat file. What service? "Vijay" wrote: > Hi, > > Please tell me, how can i disable service with bat file. > Please tell me, how can i disable service with bat file. That's funny ... weren't we just talking about Permissions? :-) Anyway, the command to control a Windows Service (enable, start, stop, disable, etc) is SC.EXE. Run SC /? at a command prompt to see the syntax. Put the necessary SC command in a batch file, and you are all set. Hope it helps, Andrew -- amclar at ...

Print Preview "Prev Page" but is always disabled
Hello, I have created an MFC application and have added Printing and Print Preview capability. The only problem i have is that the Prev Page button on the Print Preview toolbar is always disabled. The "Two Pages" button and "Next Page" are enabled and work correctly. I am setting the CPrintInfo::SetMaxPage() and CPrintInfo::SetMinPage() and CPrintInfo::m_nCurPage values in OnPreparePrinting() but this doesnt seem to make a difference. Is their anything else that i can try which will enable this button? Thanks Andy ...

disable macro warning
I added macro which I then deleted. Every time I enter system it asks me if I want to disable or enable macros - how do I turn off this warning screen upon entering system when I have no macros in the worksheet? You need to remove the module that contained the macro. Press ALT+F11, go to View > Project Explorer (if needed), right-click on the module(s), and remove it. Save. HTH Jason Atlanta, GA >-----Original Message----- >I added macro which I then deleted. Every time I enter >system it asks me if I want to disable or enable macros - >how do I turn off this warnin...

Disable sending Email
In Exchange 5.5 in an NT Domain, is there a way to disable an user from sending email? He should be able to open and read his email but not be able to send out email untill permitted. Thanks On Wed, 16 Mar 2005 15:01:03 -0800, "SI" <SI@discussions.microsoft.com> wrote: >In Exchange 5.5 in an NT Domain, is there a way to disable an user from >sending email? He should be able to open and read his email but not be able >to send out email untill permitted. > >Thanks You can do this on Internet mail by setting the Delivery Restriction on the IMS to deny mail...

Moving items from one department to another in bulk.
We would like to merge all items in department "A" to be in department 'B". What is the query wording for this task. Thank you, ...

non-XP CListCtrl with groups
I like the grouping feature in MFC's CListCtrl, but it only works for XP. Has anybody seen any code that implements this feature for previous OS's? I searched around for quite a while and came up empty. I'm looking to do it for an icon view. So, I'd have labeled groups of thumbnails in a scrollable window. ...

CListCtrl,logoff
Hi, I wrote NTService which run by CreateProcessAsUser MFC application which include CListCtrl.When I logoff from the computer I get this error: "...Breakpoint A breakpoint has been reached (0x80000003) occurred in the application at location ..." I notice that if I remove the CListCtrl from the MFC application I don't have any error at all. How Can I fix it? Thanks, Mariel ...

Deleting items from offline inventory
I currently use offline inventory to account for products packaged in our warehouse. Normally I would transfer this inventory into our main inventory when the products are being moved to our store. However, once in a while I would like to delete some products from the offline inventory as they might have been damaged. Well, I can't find an option that would allow me to delete products from offline inventory. What am I missing? Gerd ...

can't delete items #2
Help! Help! anybody! I have internet service with Earthlink. In adding their spamblock to my e-mail, it basically did not go well, for some reason, with my outlook. I now cannot delete any items from my inbox or deleted items. I get a message of 'The messaging interface has returned an unknown error. If the problem persists, restart Outlook.' I have tried everything. I overwrote the program. I deleted it and re-installed it. I tried repairing it. Nothing worked. There is supposed to be a detailed step-by-step fix to it on the microsoft website, but I can't find it. And I ...

Help
Hi: Hoping that someone can help with this problem. I used to use the 'created date' column to be able to track when I added an item to a folder. Whenever the item changed folder, the created date would be reset to the current time. This was an excellent feature that would allow you to quickly find items that were dropped in the wrong folder (particularly the deleted items folder). When I upgraded to outlook 2003, the 'created' date is always the same as the 'received' date regardless of where the item is moved. What gives? Is there a setting where I can ch...

Disable Cached Mode
Hi all! Is there any way to disable Cached Mode (CM) on Exchange 2003? Sure, I can do it with GPO, but some computers can be out of scope of this GPO and then they will be able to turn on the CM in their Offce 2003. But CM is critical security risk and I have to disable it. At http://office.microsoft.com/en-us/assistance/HP010000781033.aspx?Product=out2003 I can read: "Exchange server administrators have the ability to disable this feature in Outlook. For more information, contact your Exchange server administrator. Additional information for administrators is available in the Mi...

Problems opening public folder items
I have a couple of users, recently migrated to Exchange 2003 (still mixed mode environment), who cannot open items that have been mailed to public folders. Items that have been posted to the folders open without a problem. In preview mode the first few lines of the posting are visible, but preview pane shows nothing. All public folders are replicated to the Exchange 2003 server. Client upgrades have made no difference (one now on Outlook 2003, one on XP). All other migrated users are fine. Exchange 2003 SP1 on W2k3. Any help gratefully received. ...

SMTP being disabled
HI Exchange 2003 / Server 2003 I'm just having a world of problems with Exchange all of a sudden... It's been up and running about 2 months but all of a sudden it's going nuts... The SMTP service is being stopped and set to disabled. This is happening each morning around 1 AM. The only thing I can find in the event logs is event 7035 - The SMTP service was successfully sent a stop control and then Event 7040 - The start type of SMTP service was changed from auto start to disabled For the life of me, I can't find what is originating these commands.... I thought maybe t...

Enable/Disable Macro Pop-Up
In the older version of Office when you opened an excel or other office document that had a macro in it - you would get a pop up and the opportunity to enable or disable it. Is there a way to get that same pop-up in 2007? See Help, macro setting Change macro security settings in Excel juamig wrote: > In the older version of Office when you opened an excel or other office > document that had a macro in it - you would get a pop up and the opportunity > to enable or disable it. Is there a way to get that same pop-up in 2007? > Right, someone else told me the...

Protecting sheet disables Grouping buttons
I am delivering a worksheet to a client, and have protected it. As well as stopping people changing the data, though, it also stops them using the Grouping buttons. How can I enable grouping on a protected sheet? If you already have the outline applied, you can protect the worksheet in code (auto_open/workbook_open??). Option Explicit Sub auto_open() With Worksheets("sheet1") .Protect Password:="hi", userinterfaceonly:=True .EnableOutlining = True .EnableAutoFilter = True End With End Sub (I wasn't sure what caused your outlining--...

Include back ordered items on Pick ticket in 8.0.
A change was made to the printing of the Pick ticket in version 8.0. As part of that change the ability to print a pick ticket including back order items was eliminated. That flexability needs to be put back into the product. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the messag...

How to avoid item selection when combobox ShowDropDown() is called
hi,all I got a problem when I was using a CComboBox in my app. I want it work as IE's address box. When you enter http://www.m, it will display the list and show www.msn.com, www.microsoft.com, ........, all maches. But does not copy any item to address box. After I call FindString(), and then call ShowDropDown() to show the matches list, it automatically copy the first item to the combobox's editbox. I don't want this copying. Does anyone know how to do this? Thanks ...

Why does Money sometimes stop subtracting items, and instead starts adding them?!
This is something which I have NEVER understood about Microsoft Money, and which, after 4 versions of the product, they have not fixed. Normally, whenever I itemize a purchase at department store, I will enter things into the split/multiple categories, and when I do this it normally subtracts each new item I enter into that dialog box from the total amount I entered onto the main form of MS Money. But sometimes, and under circumstance I have NEVER been able to figure out, it will decide, all by itself, that it should not subtract each item entered into the split/multiple categories di...

Looking for a Top Item report
I have donwloaded the Top Item report from customer source but have a hard time changing it to what I would need. Basically I am looking for a report that allows me selection by department, category, date range, plus the fields from the downloaded report. However when running the report I would like to have quantities and amounts totalled by department, category, item number (rather then showing the individual sales per transaction). Is anybody willing to share such a report? Gerd Gerd, Are you looking at the correct report? The one you downloaded gives you the info you are look...

Disable Trended Deposits
Does anyone know how to turn off trended deposits (forecasted) feature? If you press the customize option on the left hand side, you can change it to show budget entries instead of trends -- Glyn Simpson, Microsoft MVP - Money Check http://support.microsoft.com/default.aspx?scid=fh;EN-GB;mny for UK tips and fixes for MS Money. To send Microsoft your wishes or suggestions, use http://register.microsoft.com/mswish/suggestion.asp or http://www.microsoft.com/uk/support/money/feedback especially if it's a UK specific wish. I do not respond to any unsolicited email regarding Money <a...

Disabling New Records on Forms in VB
Hi Everyone, I have designed a form which successfully supresses the ability to create new records by setting the AllowAdditions property to "No". The problem is that when I open the form using the code below the form once again allows additions and I can't figure out how to prevent this. I tagged the "Me.AllowAdditions = False" into the openargs section but to no avail. If anyone can spot the problem in my code I would be very grateful. Thanks, John ******* Start Code ******* Private Sub cmdView_Click() Dim stDocName As String Dim stLinkCriteria As ...