Customizing the way ListBox Works

I need to make ListBox work a little differently than is typically does. I need 
to add a keyboard interface for the <Insert> and <Delete> keys. I want the 
<Insert> key to add a new item, and I want the <Delete> key to delete the 
currently highlighted item. Does anyone know how to do this? 


0
olcott (220)
8/6/2006 5:04:12 PM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
607 Views

Similar Articles

[PageSpeed] 4

>I need to make ListBox work a little differently than is typically does. I need 
>to add a keyboard interface for the <Insert> and <Delete> keys. I want the 
><Insert> key to add a new item, and I want the <Delete> key to delete the 
>currently highlighted item. Does anyone know how to do this? 

Have you tried deriving your own class from CListBox and handling the
WM_KEYDOWN messages for VK_INSERT and VK_DELETE?

Dave
0
davidl7375 (2060)
8/6/2006 11:24:53 PM
I've done that for delete, and it works.
				joe
On Mon, 07 Aug 2006 00:24:53 +0100, David Lowndes <DavidL@example.invalid> wrote:

>>I need to make ListBox work a little differently than is typically does. I need 
>>to add a keyboard interface for the <Insert> and <Delete> keys. I want the 
>><Insert> key to add a new item, and I want the <Delete> key to delete the 
>>currently highlighted item. Does anyone know how to do this? 
>
>Have you tried deriving your own class from CListBox and handling the
>WM_KEYDOWN messages for VK_INSERT and VK_DELETE?
>
>Dave
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15975)
8/7/2006 3:12:05 AM
I haven't tried anything yet. I always ask the experts first. How would I go 
about handling these messages, what sort of syntax is involved? Do I make 
another message map, or something?

"David Lowndes" <DavidL@example.invalid> wrote in message 
news:jfucd2d02pl5tfojgin3amubd525ctubb5@4ax.com...
> >I need to make ListBox work a little differently than is typically does. I 
> >need
>>to add a keyboard interface for the <Insert> and <Delete> keys. I want the
>><Insert> key to add a new item, and I want the <Delete> key to delete the
>>currently highlighted item. Does anyone know how to do this?
>
> Have you tried deriving your own class from CListBox and handling the
> WM_KEYDOWN messages for VK_INSERT and VK_DELETE?
>
> Dave 


0
olcott (220)
8/7/2006 4:31:03 AM
Thanks for your support.

"Joseph M. Newcomer" <newcomer@flounder.com> wrote in message 
news:brbdd212b9bvk3m43luda13vqqsgnkj2hg@4ax.com...
> I've done that for delete, and it works.
> joe
> On Mon, 07 Aug 2006 00:24:53 +0100, David Lowndes <DavidL@example.invalid> 
> wrote:
>
>>>I need to make ListBox work a little differently than is typically does. I 
>>>need
>>>to add a keyboard interface for the <Insert> and <Delete> keys. I want the
>>><Insert> key to add a new item, and I want the <Delete> key to delete the
>>>currently highlighted item. Does anyone know how to do this?
>>
>>Have you tried deriving your own class from CListBox and handling the
>>WM_KEYDOWN messages for VK_INSERT and VK_DELETE?
>>
>>Dave
> Joseph M. Newcomer [MVP]
> email: newcomer@flounder.com
> Web: http://www.flounder.com
> MVP Tips: http://www.flounder.com/mvp_tips.htm 


0
olcott (220)
8/7/2006 4:31:49 AM
Peter Olcott wrote:
> I haven't tried anything yet. I always ask the experts first. How would I go 
> about handling these messages, what sort of syntax is involved? Do I make 
> another message map, or something?

You derive a class from CListBox, using the IDE.  It will have a message 
map.  Add the messages you want to handle.

Then, to hook it up to the list box, use the IDE to create a control 
member variable, of your class, in the parent dialog/formview.

-- 
Scott McPhillips [VC++ MVP]

0
Scott
8/7/2006 5:20:00 AM
Here's a link to tons of articles:

http://www.codeproject.com/combobox/

Tom

"Peter Olcott" <olcott@att.net> wrote in message 
news:9mzBg.1983$uW1.1561@dukeread06...
>I haven't tried anything yet. I always ask the experts first. How would I 
>go about handling these messages, what sort of syntax is involved? Do I 
>make another message map, or something?
>
> "David Lowndes" <DavidL@example.invalid> wrote in message 
> news:jfucd2d02pl5tfojgin3amubd525ctubb5@4ax.com...
>> >I need to make ListBox work a little differently than is typically does. 
>> >I need
>>>to add a keyboard interface for the <Insert> and <Delete> keys. I want 
>>>the
>>><Insert> key to add a new item, and I want the <Delete> key to delete the
>>>currently highlighted item. Does anyone know how to do this?
>>
>> Have you tried deriving your own class from CListBox and handling the
>> WM_KEYDOWN messages for VK_INSERT and VK_DELETE?
>>
>> Dave
>
> 


0
tserface (3861)
8/7/2006 3:11:25 PM
Reply:

Similar Artilces:

How to create new lead for existing customer?
We are tracking all new leads, whether it is a new prospect or new lead within an existing customer. But when you enter a new lead, it will not allow you to pull an existing account. You have to rekey all company data. Any thoughts? Seems kind of like a backwards approach (which is why there's no option to do this). I would think you would just create a new contact inside an existing account. -- Brandon IT Director Presentations Direct - Office Equipment & Supplies http://www.presentationsdirect.com "Jan Kratochvil" <Jan Kratochvil@discussions.microsoft.com>...

DCount works/DLookup doesn't work
Hello, I need some help with what's probably obvious. for variables intRFIo As Integer and stRFIs As String This works: intRFIo = DCount("*", "ClientEngagementNotes", "[ClientID]= '" & Me.ClientID & _ "' AND [EngagementID] = '" & Me.EngagementID & _ "' AND [EngagementYr] = '" & Me.EngagementYr & _ "' AND [RFI]= " & True & _ " AND IsNull([RFIRec])") This does not work: stRFIs = DLookup("StaffID", "ClientE...

last added line always visible in listbox
Hello I add new lines to listbox using AddString(); I want that last added line to listbox was visible when I put many many new lines. Now I always see top of list even I add many lines. Is some simple way to do this ? "tio" <tomjey@wp.pl> wrote in message news:1155909533.593851.160030@m73g2000cwd.googlegroups.com... > Hello > I add new lines to listbox using AddString(); > I want that last added line to listbox was visible when I put many many > new lines. > Now I always see top of list even I add many lines. > Is some simple way to do this ? > Maybe a...

internet is not working in IE8, while same settings works in mozil
hi i am connected to internet using LAN.and i am using the windows2007 OS. i have configure the same proxy settings in internet explorer , Mozilla and GTalk. but i can not access the internet from internet explorer, while Mozilla and Gtalk are connected to internet. i have reset the default setting of internet explorer but that also not working. anyone please help me to sort it out. even some times the LAN icon will show limited connectivity while i am able to access the internet from Mozilla and Gtalk . thanks in advance ...

Autoarchive not working anymore
Had tried to archive the calendar which is older than 6 months but nothing was archived. Had did the neccessary settings already. Please advise. Thanks. Hui lian Check the Last Modified date on the items that aren't being archived as you think they should. That's the date Outlook uses to determine whether or not an item is ready to be AutoArchived, and a simple action such as moving the item to another folder can change the Last Modified date. More information and a list of actions that change the Last Modified date can be found here: http://support.microsoft.com/default.aspx?s...

Autofill not working in Terminal Session
I have a terminal session user whose autofil in her Outlook account is not working. The optionto turn on this feature is missing fom the Tools - Options location where is customarily is. I have not looked too deeply into this. Anyone have any suggestions? Thanks. ...

Error after creation a custom field with Schema manager
This is my first attempt to customize the CRM. I used Schema manager to create a new field (attribute) and it seemed to be allright there. Then I published the customization, restarted the IIS and entered the CRM. Now an attempt to enter the customized area (I tried it with Leads and Opportunities) produces an Error without any informative message. Yet, I successfully customized a form with a new tab, new screen controls and OnChange event. Did anybody encounter a similar problem and/or knows a cure? boazM Do you removed any field? To see the error details turn On DevErros key on web.co...

Outlook Custom Form Installation Error
Here is my problem: We just upgraded Microsoft Office 2003 to Service Pack 3, and now a custom form is broken. The users that used this form used to double click the .oft file on their desktop to launch it. Now when they double-click it, they get a message saying "The custom form could not be opened. Outlook will use an Outlook form instead." When I attempt to install the form to Outlook using the Tools --> Options --> Other --> Advanced Options --> Custom Forms --> Manage Forms --> Install option, I get this error message: ---------------------- The form could not...

Code not working
I need to capture the Last Row number as soon as the WB opens; And as the sheet2 Column A cells are filled-in have the variable Lrow furnish an up-to-date value, representing the last non-blank row in Col A of Sheet2. The below is not working; Can yo suggest a better way? TIA, Dim Lrow As Long Private Sub Workbook_Open() Lrow = Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Row End Sub Press Alt + F11 to open the VB editor. In the Projects pane at the upper left side of the screen, double click on ThisWorkbook and paste the code into the code wind...

Can MS Works spreadsheet be imported into Excel?
Have tried to import a Works spreadsheet to Excel - have just updated to Excel and would have thought the two would be be compatible and seamless; when I try this I get an error.Any thoughts on how to do this or if it even can be done? In the File/Open dialog box, if you click the arrow next to "Files of Type", you'll see the list includes Microsoft Works 2.0. If your file is from a later version of Works, I believe you need to open it again in Works and save in either Works 2.0 or Excel format. The other option is to buy a converter like Dataviz' Conversions Plus for US$...

Could not install the custom action
I'm running O2K7-TR and just recently started getting this error whenever I go to work with a message. I get the error whether I'm composing new, replying or forwarding. I'm trying to figure out where to look to troubleshoot this. All the searches I've done on custom actions have to either pertain to message rules or forms. Obviously, something is no longer where it was but the question is where and what is trying to access it. I'm thinking that because it's happening on any kind of composition that it is relating to the default template but i can't mak...

Buttons have stopped working?
Hi all, I have been in and out of my database throughout today, and i just went in to update it and all the buttons have stopped working! I get the following message whenever i click one of the buttons on any of the formss: "The expression On Click you entered as the event property setting produced the following error: Error accessing file. Network connection may have been lost. - The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]. - There may have been an error evaluating the function, event, or macro." The only...

CRM 4.0 Display content of custom entity throws exception.
The following errorreport is shown on a display request for a custom entrity: http://perfectv-mcjywm:5555/GemeenteRommeldam/_root/homepage.aspx?etc=10036 Microsoft CRM Error Report: Error Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Error Details: Exception of type 'System.Web.HttpUnhandledException' was thrown. Full Stack: [FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).] ...

Query Date Help W/Avg work days
please note that in order to get the date 6/28/1979 I am using average work days each month of 21.75 I have tried to Add just the total days to the date but it's not correct because I need it to be based off the 21.75 days per month not actually days. Total Years of Prior Service Days Hire Date Adjusted Hire Date 7 years 4 months 6 days 2685 6/15/1987 2/7/1980 (s/b 2/9/80) 1 year 8 months 13 days 620 2/10/2005 6/1/2003 (s/b 5/27/03) This is what is being calculated so far once I run the query. "aldunford" wrote: > This worked great thanks so much!! I have ...

The merge center icon remains gray and does not work.
I have Excel 2003. The Icon for Merge and Center does not work. It remains gray. Any ideas on how to get it to work? I tried to add the icon on again by customizing the formatinmg toolbar, but that icon did the same thing, nothing. Is the sheet protected? If not you may well have a corrupt file. You can save the day by copying and pasting to a new workbook, tedious but better than losing your work. Regards, Alan "mrspeaker" <mrspeaker@discussions.microsoft.com> wrote in message news:2CB1A6E4-D0AF-4505-AB6C-59601115EFD8@microsoft.com... >I have Excel 2003. The Icon...

How to copy custom number formats
Hello All I have a custom number format for a Excel Cell A1 which is #,##0.00 "CAD" and in A1 I now have a value 1000 CAD. I have assigned cell B1 as =A1 but an external application when the report is run populated now cell A1 as 20000 MXP and now my cell B1 says 20000 CAD and not 20000 MXP and when I check the format for B1 it still as the format as #,##0.00 "CAD" whereas now the format of my cell A1 is #,##0.00 "MXP" appears only the value and not the format is being copied. Can any of you suggest a workaround to resolve this problem. Many thanks Simon ...

Best way to make name tags?
I need to set up a template for some name tags to be 3.5" by 2.5". Is there an easier way to do this besides messing around with text boxes? I was trying to do it through the Custom Publication through Page Setup, but then they all have to be exact same and I can't change the names for each tag. I don't have any special paper or anything, just the measurements that they need to be. Any thoughts or guidance would be very much appreciated! Are you planning a mail merge so each name tag will be different? If you plan to print many tags on a page and cut them yourself, your...

Ratio of Offshore work amount to Onshore work mount?
Hi alls, Our company wants to develop the Greatplains consulting service in the US. Because we have an offshore development center in Asia, we want to leverage the quality and cost by onshore+offshore service model. My question is, do you think offshore resources can provide service based GP? If answer is yes, what is the ratio of offshore work amount to onshore work amount? Any information is appreciated? Thanks. Thisguy ...

How do work web DNS queries when there is no ISP DNS given
Thanks for all the help I have already received from this group members. How DNS is resolved when there is no ISP DNS servers listed in SBS 2008 settings yet? An built in external MS DNS connection? Are lthen ocal ISP DNS entries even essential, if web access is granted by built in external DNS connections and where is correct to add local ISP DNS? I found several possible locations: 1. I have found in literature - Local server DNS properties Forwarders 2. IPv4 Scope Options -> DNS servers by default local SBS IP but I have seen there added extra ISP DNS numbers. And ...

Outlook rules wizard does not work consistently
I wish to have a rule that I created, apply to all messages (I want it to forward all messages to an alternate address). The wizard actually gave me a warning that the rule would be applied to all messages, but in practice it sporadically applies itself. (even on the same test email sent multiple times. ...

Works / Excel
I am having trouble changing files from works 4.5 to excel 2002. any comment welcome. Generally you would normally open the file in WORKS and then save it down as a file that Excel can read. .xlr is a native Excel format, or .txt, .csv, dbaseIV are all formats it can read. You can also find a converter here if you don't have WORKS. http://www.rl-software.com/indexjs.htm?/converter/wkscnvxls_e.htm Text from the website above:- Microsoft does not provide an import Excel filter for Works-WKS files later than version 2. (for Works-WPD and Word they do). There is no standard way to conv...

Shakersort & my modifications that don't work :(
Excel 2003 The function below is a shaker sort, adapted from the website referenced in the code. I need to make two changes to it; (1) I'll be feeding this two different arrays and I need to sort them both the same way (as if it were a 2D array), so I added a second array and related sorting based on any sorts that occur to the first array, and (2) I need to have these modifications persist back to the calling procedure. I thought ByVal would change the "real" array in memory, but if that doesn't work I need to pass both arrays back to the calling procedure. ...

Bast way to internationalize app with dlls
I have an application that has functionality broken up into several dlls, some dynamically loaded (plug-in style), and others statically loaded (code shared by the exe and the dynamic dlls). The exe and the dlls all have their own resources (English). I want to be able to change the language of the application on the fly. In the past, when I only had a single exe, I just created several resource-only dlls and used AfxSetResourceHandle(). However, now that I have broken functionality into additional code dlls, things are more complicated. 1) What is a good architecture to handle langua...

HELP macro not working
I am attempting to run some macros that transfers an access database to a psql database. I'm not familiar with that particular db technology, but am somewhat familiar with transferring data via ODBC. Anyways when I attempt to run the macro that transfers the data I get ODBC call failed. Unrecognized key passed to SQLGetinfo30. (#209). ...

having problem getting scanner working in xp mode
Does xp mode work in 64 bits if win7 is 64? i couldn't figure out how to see what it was set at. the problem i am trying to solve is my pana-vue scanner to convert old 35mm slides to digital. i can get the scanner working with win7 and have downloaded the new driver from the website but when i view a slide, the top of the slide is stable but as the scan goes down, the picture is changing tilt every couple of seconds, probably trying to sync. so i thought maybe XP would work better. the install program has 32 bit and 64 bit drivers and i installed the 64 bit drivers but...