typing in modeless dialog -> gets intercepted by accelerator table

I have an MFC application with a regular Accelerator Table in a resource.
I have chosen for shortcuts containing no CTRL or SHIFT or ALT... since that 
makes for a fast workflow. This technique is used in many CAD & 
3D-applications.

However, when I use a modeless dialog (in fact, a dialog in a docked 
sidebar) and I want to type text into it, the accelerator keys get priority 
and thus prevent certain characters to be typed...

I thought that I could use PreTranslateMessage to catch them before they are 
sent to the MainFrame, which I can, but at that time, they are also catched 
from arriving into the editbox...

Any tips? Or would it be better to get rid of the accelerator table and 
catch the keys manually?

 --- stefkeB --- 


0
stefkeB (8)
5/11/2005 1:48:09 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
793 Views

Similar Articles

[PageSpeed] 34

Anyone?

Can I temporarily switch accelerator tables while a dialog is active and 
then use a dummy one? Seems a very ugly hack, but I don't know if it's even 
possible.

I found tutorials on enabling the shortcuts in modal Dialogs but I need to 
do the reverse: disable shortcuts on a modeless dialog...

 --- stefkeB ---

"stefkeB" <stefkeB@hotmail.com> wrote in message 
news:eoBUVAjVFHA.544@TK2MSFTNGP15.phx.gbl...
>I have an MFC application with a regular Accelerator Table in a resource.
> I have chosen for shortcuts containing no CTRL or SHIFT or ALT... since 
> that makes for a fast workflow. This technique is used in many CAD & 
> 3D-applications.
>
> However, when I use a modeless dialog (in fact, a dialog in a docked 
> sidebar) and I want to type text into it, the accelerator keys get 
> priority and thus prevent certain characters to be typed...
>
> I thought that I could use PreTranslateMessage to catch them before they 
> are sent to the MainFrame, which I can, but at that time, they are also 
> catched from arriving into the editbox...
>
> Any tips? Or would it be better to get rid of the accelerator table and 
> catch the keys manually?
>
> --- stefkeB --- 
>
> 


0
5/12/2005 8:56:10 AM
FWIW, I could solve my problem, by letting the Dialog class transfer it's 
PreTranslateMessage() to the native CDialog version instead of CDialogEx.

It all works fine now: my shortcuts keep working, but are temporarily 
disabled when I edit text fields in my dialog.

And I did some pre-checking, so I don't filter every keypress away...

(Found it by accident, by doing a Google search, where I ended up in a 
buglist for an OpenSource MFC-application and that lead me to the 
solution....)

"stefkeB" wrote:

> Anyone?
> 
> Can I temporarily switch accelerator tables while a dialog is active and 
> then use a dummy one? Seems a very ugly hack, but I don't know if it's even 
> possible.
> 
> I found tutorials on enabling the shortcuts in modal Dialogs but I need to 
> do the reverse: disable shortcuts on a modeless dialog...
> 
>  --- stefkeB ---
> 
> "stefkeB" <stefkeB@hotmail.com> wrote in message 
> news:eoBUVAjVFHA.544@TK2MSFTNGP15.phx.gbl...
> >I have an MFC application with a regular Accelerator Table in a resource.
> > I have chosen for shortcuts containing no CTRL or SHIFT or ALT... since 
> > that makes for a fast workflow. This technique is used in many CAD & 
> > 3D-applications.
> >
> > However, when I use a modeless dialog (in fact, a dialog in a docked 
> > sidebar) and I want to type text into it, the accelerator keys get 
> > priority and thus prevent certain characters to be typed...
> >
> > I thought that I could use PreTranslateMessage to catch them before they 
> > are sent to the MainFrame, which I can, but at that time, they are also 
> > catched from arriving into the editbox...
> >
> > Any tips? Or would it be better to get rid of the accelerator table and 
> > catch the keys manually?
> >
> > --- stefkeB --- 
> >
> > 
> 
> 
> 
0
stefkeB1 (1)
5/12/2005 12:16:03 PM
You are kind of
You should override PreTranslateMessage in your *application class*.
Test if window handle belongs to edit control and if it does, return FALSE. 
Otherwise call base class PreTranslateMessage.
You can (should) do it for all controls that need keyboard input.

Check controls Windows class names using handle passed by pointer to MSG 
structure. 


"stefkeB" wrote:

> Anyone?
> 
> Can I temporarily switch accelerator tables while a dialog is active and 
> then use a dummy one? Seems a very ugly hack, but I don't know if it's even 
> possible.
> 
> I found tutorials on enabling the shortcuts in modal Dialogs but I need to 
> do the reverse: disable shortcuts on a modeless dialog...
> 
>  --- stefkeB ---
> 
> "stefkeB" <stefkeB@hotmail.com> wrote in message 
> news:eoBUVAjVFHA.544@TK2MSFTNGP15.phx.gbl...
> >I have an MFC application with a regular Accelerator Table in a resource.
> > I have chosen for shortcuts containing no CTRL or SHIFT or ALT... since 
> > that makes for a fast workflow. This technique is used in many CAD & 
> > 3D-applications.
> >
> > However, when I use a modeless dialog (in fact, a dialog in a docked 
> > sidebar) and I want to type text into it, the accelerator keys get 
> > priority and thus prevent certain characters to be typed...
> >
> > I thought that I could use PreTranslateMessage to catch them before they 
> > are sent to the MainFrame, which I can, but at that time, they are also 
> > catched from arriving into the editbox...
> >
> > Any tips? Or would it be better to get rid of the accelerator table and 
> > catch the keys manually?
> >
> > --- stefkeB --- 
> >
> > 
> 
> 
> 
0
RainMan6256 (150)
5/12/2005 12:20:02 PM
Reply:

Similar Artilces:

Selecting Maximum Values in a Query with joins to other tables
I'm having difficulty with a query and hope someone can help me out. Basically, I'm looking to select the maximum amounts from a table based on a column in one of the tables named StateID. It works fine when I do this: SELECT TOP (100) PERCENT dbo.Bids.StateID, MAX(DISTINCT dbo.Bids.Amount) AS Amount, dbo.States.StateName FROM dbo.Bids INNER JOIN dbo.States ON dbo.Bids.StateID = dbo.States.StateID GROUP BY dbo.Bids.StateID, dbo.States.StateName ORDER BY dbo.States.StateName However, when I start to join fields from other tables in...

Pie of Pie Chart type with smaller pie showing slices of main slic
Hi How can I do the following: Lets say I have the following labels and data For the main pie I have A,B,C labels with A =5, B =10, and C =20. So my main pie would show 3 slices with C being the largest slice. To do this I highlight the 3 labels and their data and choose Insert, Pie, Pie in a Pie to show a main pie on the left with 3 slices and a smaller solid pie to the right with series lines connectiing them. I want to show the solid smaller pie on the right in several slices to show how the C slice of 20 is broken down. lets say the main slice C of 20 is made up ...

adding records to multiple tables in MSDE 2000 from XML using ADO.NET
I am using .NET web aplication and MSDE 2000. I receive new record in XML format which I want to add into MSDE 2000. I am doing it as below. Private Sub InsertNew(ByVal sData1 As String) Dim SR1 As System.IO.StringReader = New System.IO.StringReader(sData1) DS1.ReadXml(SR1) SqlDataAdapter1.Update(DS1) End Sub This works fine with one table. But say, I receive following XML data: <ORDER> <COMPANY>DIXON</COMPANY> . . . <ITEMS> <ITEM> <NAME>SONY - 32 inch</NAME> <QTY...

Typing in macros
I have made a few macros and use them in word and excel 2000. When I see typed out macros on the message boards I am not quite sure how to use them. Do I go into the editor, type them in and then link them with a button on the toolbar? What module do I put them in and is there one for the personal worksheet. I have been struggling with the syntax of Visual Basics for years. Just need a step by step explanation. Thank You Sue In general, the macros you see in the groups are likely to be ordinary macros that will go into a general module in the VBE, eg:- Hit ALT+F11 and this will...

Open File Dialog to fileter multiple file types at once...?
Hello, Here is another quick one for you all. The solution is probably simple, but I cannot find the answer anywhere. I have the following code: CFileDialog OpenDlg(TRUE, NULL, NULL, OFN_ALLOWMULTISELECT | OFN_HIDEREADONLY, ""); // Later must set this to retrieve a value from the registry OpenDlg.m_ofn.lpstrInitialDir = "c:\\"; OpenDlg.m_ofn.lpstrFilter = "txt Files\0*.txt\0Doc Files\0*.doc\0"; OpenDlg.DoModal(); I am trying to get the box to filter out everything but the *.doc and the *.txt files ... I have seen some boxes that have something that...

Table Size Limitations 09-08-05
Hello, I am hoping you can help me answer this probably easy question. I am trying to add some new columns to the contacts table in 1.2 and I believe I am running into a space limitation. I have added about 550 bytes of information to the table and then I started getting the error. There error that I am getting or the system log does not have any information in it as to what the error is. I am a little confused as to why I would be getting this error, I realize that there is a 8000 byte sql limit, but the stock contact table has around 3700 bytes and I have only added 550 bytes. Whe...

How to bring a dialog itself to top?
I have a dialog based MFC application. In this app, there is only dialog, and there is a textbox on the dialog. Also there a thread in this app that receives data from IP intranet. If the thread receive some message, then I need the user to input something in the textbox. At that time, I want to bring the dialog to top and put input focus to the textbox. I use the folloing code in CMyDialog: void CMyDialog::BringMeToTop() { WINDOWPLACEMENT pl; pl.length = sizeof(pl); GetWindowPlacement(&pl); if (pl.showCmd == SW_SHOWMINIMIZED) { pl.showCmd = SW_RESTORE; ...

Rectification of wrong posting type
Hi There is one PL account say "Mic Expenses" has got wrong posting type "Balance sheet", when we closed the year 2005 ,System has brought forward the balance of that account into next year 2006, which otherwise should have been gone into the Retain Earning of 2006, is there any option to rectify this error, other then passing rectifying JV in 2005(coz in that case if I take last year TB then ending balance of this account would be Zero) or restoring the backup and doing closing procedure again. Thanks in Advance Shabnam There is a Article ID for this in partner s...

Build Table of Figures with Figure Number, but without caption lab
Anyone know how to build a Table of Figures that includes the figure number and page number, but doesn't include the caption label "Figure" repeated for every entry in the table? -- Michael This can't be done unless you use a macro to build the TOF. What you can do, via the user interface, is exclude the label *and* the figure number. -- Stefan Blom Microsoft Word MVP "Michael" <michael@discussions.microsoft.com> wrote in message news:FAC86167-8903-4899-A127-EF331053A8F0@microsoft.com... > Anyone know how to build a Table of Fi...

how do i work with column header in visio 2003? is this a table?
column header in visio 2004 is a table or just a blank page? ...

Some chart types cannot be combined with other chart types?
Hi, I am getting the above error message everytime I try to insert a chart or any type into a completely blank presentation using either the Insert, Chart command or the Insert Chart button in the Title and Content slide layout. I am using 2007. Any help or suggestions would be appreciated. TIA, Shane Devenshire Try running Office Diagnostics, Shane. Open PPT or Excel, hit the Office button, then <app> Options | Resources. I think that may resolve this issue. -- Echo [MS PPT MVP] http://www.echosvoice.com What's new in PPT 2007? http://www.echosvoice.com/2007...

Table link documentation
I am having trouble trying to locate A/P check data that has project related costs. I found the check data but it is does not indicate the projects, I found the project data but can not determine thye logical link between the two tables, I may be using the wrong tables the tables I am using are PM80500 and PA31102. Is there any documentation of how all the tables in the system are logically link. I am trying to write reports in MS Access, but there are 1500+ tables in GP (version 10) -- Dave F In an effort to find the correct table you can do a number of things (believe me I do)....

need help to declard type=IntType instead type="xsd:int" with xml schema
Hi, I am writing C# code to produce xml schema. //Create attribute XmlSchemaAttribute att2 = new XmlSchemaAttribute(); att2.Name = "CustomerID"; att2.SchemaTypeName = new XmlQualifiedName("int",schemaNS); att2.Use = XmlSchemaUse.Required; ct.Attributes.Add(att2); I need to produce schema with custom data type instead of the xsd:string or xsd:int The code above will produce the following schema <?xml version="1.0" encoding="utf-8"?> <xsd:schema attributeFormDefault="unqualified" version="1.0" xmlns:xsd=...

Refreshing a pivot table #2
I have posted this question before but didn't get any replies so am trying again in the hope that somebody knows the answer.....!! When using a pivot table, is it possible to refresh only certain columns rather than the whole table?? Any urgent help would be appreciated. Thank you. Louise You can't refresh only part of a pivot table. Perhaps you could make a copy of the source data, change only the data you want updated in the pivot table, and base the pivot table on that. Louise wrote: > I have posted this question before but didn't get any replies so am trying > ...

Scatterplots with different colors based on Type of Data
Is it possible to plot a scatterplot with different colors for 2 sets of data? E.g Type of Agreement MRP Discount% Limited 10 5% UnLimited 20 10% I want to show different colors for Limited & Unlimited. Is it possible to plot scatterplots on both axis(Primary & Secondary) Please let me know. Thanks, Satish If I use this range to make a chart Limited 10 5% Unlimited ...

neededing to make text pivot table if possible
I need to look at my employees names & the job they did on each particular day. Maybe something similar to the pivot table could help. Something that I could pull one persons name and every date & the job they did I could easily see. Or I could pull the job title and I could see the data that way. Is there a way to put this information into the spreadsheet in a certain way where some formula can help me?? --- Message posted from http://www.ExcelForum.com/ Jewels, If you show how your data is set out it may help to advise you. If you're staring from scratch, I'd make sure th...

insert, append from form to table
I have a form bound to a query made up of several tables, and to try and speed things up, I am using unbound combos (sourced by lookup tables), and running append queries before exiting the form, after all of the fields are filled in. This works fine for completely new records, but what do I do if I would like to change existing ones? I tried to run update queries from If Me.[form_cbo_box_name] <> Me.[txt_field_from_main_query] Then but it won't fire. I need to find out if the combo has changed, and update it if it has, append it if it was formerly blank, and ignore it i...

outlook type interface
I have an SDI application and want to change it so I have a split window, on the left I want a TreeControl above a 'PropertyGrid' control. Then my exisiting SDI Client in the space on the right Can anyone point in the right direction to achieve this Any help will be much appreciated Thanks Phil You need to use two CSplitterWnds (as members of your CMainFrame). Override CMainFrame::OnCreateClient and create a vertical splitter as the main child (i.e. 1 row, 2 cols). Then you want to create a horz splitter as a child of the left-hand pane of the main splitter (which has 2 rows, 1 c...

VSTO Excel 2003 to VB 6.0 Type mismatch
Hi, I have an Addin 2003 Application. In this Application I'm calling an VB 6.0 Dll and I send Excel Application Object as Parameter. In VB Project I'm using Workbook_Open event with WithEvents. I have a messagebox there. Unfortunately when i call VB dll , I get this Error Message -- > Type mismatch. Is there any Idea? Code in VS2008 : private Project1.Class1 vbapp; private void ThisAddIn_Startup(object sender, System.EventArgs e) { #region VSTO generated code this.Application = (Excel.Application)Microsoft....

predictive typing of addressee
I am frequently sending sensitive email to a person who has a very common name. More than once I have almost sent the email to the wrong party because of the Outlook feature that predicts the addressee name. Does anyone know how to eliminate names from the dropdown list that appears as you type tha addressee name? Or is there a way to stop addressee names from appearing automatically as you type in the "To" field. Any help will be appreciated. joanne Use arrow keys to highlight error address, then hit Delete Btn Do you use Contacts?, hitting the 'To' Btn will bri...

"Can't change data type" error
I'm trying to reduce the field size of text fields in my database. They defaulted to 255 characters when I created my database but in many cases I only need a size of around 20. When I enter the reduced size for one field in the table design view and try to save the change to that field I get the following errors: "Microsoft Access can't change the data type. There isn't enough diskspace or memory." When I click OK to the above I then get the following message: "Errors were encountered durnig the save operation. Data types were not changed. Properties w...

How to convert CString type to LPCSTR type
Hi, I have a CString type variable, and I need to convert it's to LPCSTR type ,what I can do! example: CString m_strExecFile(_T("C:\\\\aa.exe")); next I want to call WinExec Command to execute this file LPCSTR lpcstr ; lpcstr = m_strExecFile.GetBuffer(); WinExec(lpcstr,SW_SHOW); BUT the compilier tells me it can not convert w_char * to LPCSTR type! Why? ps. I use vs2005 program in UNICODE mode. Any helpful ideas would be highly appreciated! -joseph Why use a CString in this case at all, if all you are doing is using it in WinExec. Something ...

Remove a table from partitions
SQL 2005 64 bit EE I have a large database with several partitions and lots of data. One of the tables that is across the partitions I'd like to move to a new file group outside the partition file groups. IOW - I don't want this table partitioned anymore. To get this table on a file group not a part of the partition scheme, is it as simple as rebuilding the clustered index on the new (non-partition) filegroup? Thanks On Thu, 1 Jul 2010 13:51:53 -0400, "cw" <cw@3mc.com> wrote: >SQL 2005 64 bit EE >I have a large database with several part...

Console to Dialog
I'm trying to port a console based app to a dialog based app so that I can have access to gui controls. The console app connects to a remote server and process the data from the server through a dll. It does this by starting a thread which begins a session and handles the incoming data with callback functions. I tried porting by creating a regular dialog app with a button control that would start the main thread of the console app which I created a class for. I took out all references of creating or messaging the console window, so just the session/callback code remained. The dialog crash...

Project and Canadian Payroll Table References to SQL
I have and Excel mapping of GP tables to the SQL physical tables, which I find very helpful. However, I don't have the same for two key modules that we use: Project and Canadian Payroll. Does anybody have these to share? Don't have a system in front of me to check with, but the Canadian Payroll tables all start with CPY. You can print all of the details using Resources > Tables and selecting Canadian Payroll as your product and Project as the series. -- Lyle U Dwayne wrote: > I have and Excel mapping of GP tables to the SQL physical tables, > which I find very helpf...