Enter button

I'd like to apply a method (search) on pressing the enter key, on an embedded 
dialog. I've implemented the afx_msg void OnAccelReturn() method, and it 
works well in some context.
In another context, nothing happens when the enter key is pressed. I've also 
tried to set the focus on the search-button and to declare the search-button 
as the default-button, but I didn't help to fix the problem.
Maybe it has something to do, whether the outer-dialog is a modal one or not.
If anyone could give me any hints, why the key doesn't work would be much  
appreciated.
0
vKey (6)
5/2/2007 8:21:01 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
482 Views

Similar Articles

[PageSpeed] 24

On May 2, 4:21 am, vKey <v...@discussions.microsoft.com> wrote:
> I'd like to apply a method (search) on pressing the enter key, on an embedded
> dialog. I've implemented the afx_msg void OnAccelReturn() method, and it
> works well in some context.
> In another context, nothing happens when the enter key is pressed. I've also
> tried to set the focus on the search-button and to declare the search-button
> as the default-button, but I didn't help to fix the problem.
> Maybe it has something to do, whether the outer-dialog is a modal one or not.
> If anyone could give me any hints, why the key doesn't work would be much
> appreciated.



How are you handling Enter Key in the dialog? Are you doing it in
PreTranslateMessage of the embedded dialog?

---
Ajay

0
ajaykalra (6842)
5/2/2007 12:48:03 PM
> How are you handling Enter Key in the dialog? Are you doing it in
> PreTranslateMessage of the embedded dialog?
> 
> ---
> Ajay
> 
Yes. This section of code is not from me, but it looks like in the messages 
from all buttons are handled in there.
Additionally, I've implemented a method "onAccelReturn" where the behaviour 
is defined (start search).
What I don't understand, is that it only occurs in some specified context, 
depending on the outer dialog. With one outer dialog it works, with another 
(in another context) it doesn't.
0
vKey (6)
5/4/2007 2:54:00 PM
On May 4, 10:54 am, vKey <v...@discussions.microsoft.com> wrote:
> > How are you handling Enter Key in the dialog? Are you doing it in
> > PreTranslateMessage of the embedded dialog?
>
> > ---
> > Ajay
>
> Yes. This section of code is not from me, but it looks like in the messages
> from all buttons are handled in there.
> Additionally, I've implemented a method "onAccelReturn" where the behaviour
> is defined (start search).
> What I don't understand, is that it only occurs in some specified context,
> depending on the outer dialog. With one outer dialog it works, with another
> (in another context) it doesn't.

Its very possible that the inner dialog's PreTranslateMessage is not
being called under some context. You will need to explicitly route it
to it.

---
Ajay

0
ajaykalra (6842)
5/6/2007 1:47:49 PM
Reply:

Similar Artilces:

After running a macro the first character, entered, is swallowed
Hello, after running of any macro sometimes the first character, entered, is swallowed in Word 2000 (on Windows XP SP3). Unfortunately I connot reproduce the exact circumstances for this strange behaviour - therefore the expression 'sometimes', but I can reproduce it on different computers. What may be the reason for this strange behaviour; how can this problem be resolved? Thomas Wiedmann We would have to see the code of the macro(s) to have any chance of helping you. It sounds like perhaps the document does not have the focus after the macro is run. -- ...

Importing spreadsheet to a table from a button?
We recieve information atleast once a week if not more. Instead of having to import the table manualy into a already existing table I was wanting to know if there would be anyway that I could just go to a form that contains a button that says "Import" or whatever we decided to label it as and when you select the button, it will have a code or command (I figure a code will need to be wrote) to just go and import the data straight to the table without going through the wizard or anything else. Although if the wizard did have to be used it wouldn't be that big of a deal. If anyon...

Taskbar group buttons unchecked and Excel
When I open several files at one time in Excel, the taskbar only shows one file open, even though I have the taskbar group box unchecked. In order to show each file I have to open each file individually. How can I eliminate multiple steps to show each Excel file in the taskbar? In xl2k (and higher), you can use: tools|options|view tab|check windows in taskbar. Tisha wrote: > > When I open several files at one time in Excel, the taskbar only shows one > file open, even though I have the taskbar group box unchecked. In order to > show each file I have to open each file indiv...

Command Buttons Duplicating Function
I have a multi-sheet workbook (Excel 2003) that has a group of the same three command buttons on the top of each worksheet. Each button is linked to a separate macro. One user reports that all 3 buttons perform the same function on one specific worksheet. The functionality works fine when I test it. Any thoughts? Thanks! Your client likely changed the assignment of the buttons. Right click over each Command Button and ensure that the link has not changed. Regards, Eddie http://www.HelpExcel.com ...

Shift Enter
HOW DO I FIX DOUBLE SPACING IN OUTLOOK 2007 WITHOUT THE NEED TO USE SHIFT & ENTER? -- vettenut http://forums.slipstick.com options are here: http://www.slipstick.com/problems/dblspace_html.htm -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by email: mailto:dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlook and Exchange: mailto:EMO-NEWSLETTER-SUBSCRIBE-REQUEST@PEACH.EASE.LSOFT.COM Do you sync your mailbox with...

synchronize toolbar buttons when switching between CTabControlBar
Hi, I have an MDI application, which upon startup will display a tabbed control bar similar to the Dev Studio interface. The intention is whenever the user selects a tab, certain buttons on thetoolbar will be disable/enable accordingly. How would I be able to detect, or to be more precise, put the event handler for enabling/disabling the toolbar buttons. Adding a ON_UPDATE_CMD_UI event in the MainFrame class does not seem to work, neither is if I add the event handler in one the class that represents the individual tab. There is a main class CTabControlBar that contains methods for detectin...

Large Button Toolbar 01-22-08
I have recently seen an application written in Visual FoxPro that used a custom made toolbar that had large buttons with images on the button as well as text. Does anyone know how this same effect might be achieved in Access 2002? Thanks for any ideas, Ian. ...

Q: regarding voting buttons...
Hi, One question :) Is it possible to make 3 votingbuttons (24/12, 25/12 or 26/12) where if I choose 24/12, it writes in/books my calendar at the same time. I hope this makes sense? :-) Cheers /Rico No one knows or? Cheers /Rico >-----Original Message----- >Hi, > >One question :) > >Is it possible to make 3 votingbuttons (24/12, 25/12 or >26/12) where if I choose 24/12, it writes in/books my >calendar at the same time. > >I hope this makes sense? :-) > >Cheers >/Rico >. > ...

Count and Reset Button Clicks
Hello Experts. I have a Yahtzee game with 2 buttons/2 macros. One button (Roll Dice) rolls the dice (Calculate) and the second button (Next Player) clears all checkboxes on the sheet. However, I'd like to know if there's a way to disable the first button after it's been clicked 3 times, then re-enable it once the second button is clicked and start the count over... Please advise. I thank you for your time. We can use a Global variable to communicate between the two macros: Dim IAmTheCount As Integer Sub FirstButton() If IsEmpty(IAmTheCount) Then I...

How to enter dates?
I am new to excel. I have been tasked with creating a work schedule for 20 people on a previously established excel spread sheet/ schedule. However, it was for the last academic year and therefore the dates for each given weekday are off. Is there any way that excel can automatically fill these dates in if I enter a start and end date for each cycle, we have academic months not calender months. What I would like to do is create a row that started with, say, 8 July and ends with 22 August and have the program fill in the interval. Is this possible and if so how can I do it. Thank you in ...

Removing Command Button
Hello all, I have a code that creates a command button when the Excel file opens. The following is the code that I use: Set nBar = CommandBars("Standard") nBar.Visible = True Set nCon = nBar.Controls.Add(Type:=msoControlButton, Temporary:=True) With nCon .BeginGroup = True .Style = msoButtonCaption .Caption = "Macro" .OnAction = "RunMacro" End With What I would like to do is to remove the above command button "Macro" when the Excel file closes. I have tried to use the following co...

Enter password, even if it's stored...
Whenever I open Outlook 2002, before it runs 'Send/Receive 'it asks me for a password for my email carrier EVEN THOUGH THE PASSWORD IS STORED. When you add email accounts, there's a check-button that says "REMEMBER PASSWORD". It's checked so why do I have to keep entering my pasword. Any ideas? Thanks. You might have problems with the protected storage provider. Since you didn't mention what operating system is involved in this equation, try one of the following. http://support.microsoft.com/default.aspx?scid=kb;en-us;290684 http://support.microsoft.co...

Access the "automatically suggest a name to enter" data ?
When typing in a name in a new e-mail, Outlook automatically suggests a name to enter, and I like this. However, I have many in there that I would like to add to my contacts. At present I do not want to type in "a" and then sellect one, then add it to my Outlook contacts etc and then repeat all they way through to "Z" Other than doing this ONE at a time, is there another way? Thanks You can't even add them one at a time the way you suggest. You can only add your autocompletion cache to your Contacts using third party software. http://www.ingressor.com/deskt...

How to remove or hide the spin button by owner-draw tab control
Hi All, Same as the title, now I develop a CTabCtrlEx class derive from CTabCtrl, I use the owner-draw method to give the tab control new looking, but now the problem is I didn't want to show the spin button(UpDown Control) with single line style, how can I do that. I have try to overriding the OnSize, the code list below: //////////////////////////////////////////////////////////////////////////// //// void CTabCtrlEx::OnSize(UINT nType, int cx, int cy) { CTabCtrl::OnSize(nType, cx, cy); TCHAR classname[100]; HWND hwndSpin = NULL: HWND hWndFind = ::GetWindow(m_hWnd, GW_HWNDFI...

How to assign a macro to a commnd button
I have created a Macro to perform the task of taking the user from one worksheet to another upon clicking the command button. However when right clicking on my mouse to view the short cut menu for the command button there is no option to assign a macro to the button? The options availabl to me are the format control at the bottom of the short cut menu. How do I activate a Macro on a command button?? You can assign macros in the way you want to buttons created from the Forms toolbar. You've created a button from the Control Toolbox instead. You can use the button's _Click() eve...

grouping Radio Buttons; Using ActiveX Controls
Hello experts! I’m trying to enter radio buttons on a sheet (not UserForm) and I’m using ActiveX Controls (I don’t want users moving the controls around on the sheet so I’m trying to make the objects locked). Now, I seem to be stuck as to how to get my 6 radio buttons into 3 groups, so that I can choose three buttons. Right now, it is only letting me choose one button! Basically, this is an example of what I want to do: http://www.techonthenet.com/excel/questions/grouped_rbs.php But I need to do it on a sheet and using ActiveX Controls. Thanks! Ryan--- -- Ryan--- I...

ActiveX Option Buttons
:confused: Hello, I need to know how to tell an option button what value to return. I have a group of 4 option buttons and I have linked them all to th same cell. That's when they stop working, because they all want to say 'true' o 'false' - how do I get them to return a value instead (i.e. 1-4) so can do a calculation on the value in the linked cell? Please help -- veci ----------------------------------------------------------------------- vecia's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=211 View this thread: http://www.excelfor...

print button #3
I'm using an excel spreadsheet to record times for employees. In a daily total cell, I need for the time to be rounded to the nearest quarter hour. Right now, the format is custom set at [h].mm and it comes out as 8.30. I'd like for it to just be 8.5 I don't know what this has to do with a print button... :) Try this: =A1*24 Format the cell in which your formula lies as number, 2 digits. ******************* ~Anne Troy www.OfficeArticles.com www.MyExpertsOnline.com "C A" <C A@discussions.microsoft.com> wrote in message news:63D9C091-C944-4291-99B5-E425ED...

The "Organise" button and included functions doesn't work (2003)
Hello, I've just upgraded to 2003 from 2000, and i was tying to ad colours to certain emails. i've gone to "organise", now for some reaso off the toolbar and into the tools menu. however once i get to tha option, i get the normal screen: http://office.microsoft.com/en-gb/assistance/HA011330431033.aspx exactly as i should, however, clicking on the colors and views tab does nothing, nor does clicking on the X for the organise pane however, if i click on the new folder and rules and alerts buttons i the pane, they work normally. as a temporary stop gap, i've added a part...

CEdit AND enter-key
Hi, I have a CDialog app with a CListBox and a CEdit control. If i type text in the editcontrol followed by enter the dialog disappears, but i want the text to be added to the list box. How do i intercept the enter key so i can addstring() it to the listbox ? "RAN" <nijenhuis@wish.nl> ha scritto nel messaggio news:1186750597.981398.160060@x35g2000prf.googlegroups.com... > Hi, > > I have a CDialog app with a CListBox and a CEdit control. > If i type text in the editcontrol followed by enter the dialog > disappears Maybe you have an OK button set as default b...

opening an excel form using an access button
Hi, I have an excel form for weekly time that I would like to be able t access from an access form. Is this possible -- -Brian-H ----------------------------------------------------------------------- -Brian-H-'s Profile: http://www.excelforum.com/member.php?action=getinfo&userid=566 View this thread: http://www.excelforum.com/showthread.php?threadid=26446 Hi, Brian. Using a hyperlink doesn't work? **** Hope it helps! **** ~Dreamboat Excel VBA Certification Coming Soon! www.VBAExpress.com/training/ ******************************** "-Brian-H-" <Brian-H-.1dbjba@e...

Printing from a control button
I am trying to get a WorkBook to print from a user Form Control Button. I am not exactly sure how to get the Print Dialog Box to come up, so I can choose the printer, Print Rage, Print What, Number of Copies & Print Preview. The Name of the WorkBook will Change each time, I am not sure how to acomplish this task. Control Button = Print_Eng_Spec_12_Click() This is the save method I am using, So you can see what information is being saved as the Workbook Name. ' Save Eng Spec 11 Control Button Private Sub Save_Eng_Spec_11_Click() Dim strFile As String ...

mouse pointer to be focused on userform command button upon opening
I am opening up a userform and I want the mouse pointer to be focused on the command button I have so the user can quickly click it instead of having to move the mouse and find the command button on the form. Private Sub UserForm_activate() TextBox1.Value = ActiveCell.Value CommandButton1.SetFocus commandbutton1.(make mouse pointer goto this command button) End Sub ...

Keyboard arrow buttons no longer work in excel
I can no longer use the arrow buttons to move around my excel worksheet (to change the active cell). When I click on the up or down arrows th sheet itself moves up or down, however the active cell remains th same. I have looked in the "Tools" - "Options" area to see if I nee to set or reset something but cannot find anything. I can't imagine what happened (except I do have a few feline friend who use my pc when I'm not looking!) I would appreciate any input ... Thanks Bernadett -- bcp196 ----------------------------------------------------------------------- ...

Entering dates QUICKLY
How do I enter dates without using the / key. Eg 071004 instead of 07/10/04 (this could of course be any date). I have seen applications set up this way, but I have not been able to find a reference to how it is done. Any ideas? http://www.cpearson.com/excel/DateTimeEntry.htm -- Kind Regards, Niek Otten Microsoft MVP - Excel "DOMINIC JOSLIN" <patmag1@iprimus.com.au> wrote in message news:41b96025_1@news.iprimus.com.au... > How do I enter dates without using the / key. Eg 071004 instead of > 07/10/04 (this could of course be any date). I have seen applicatio...