Solved

How can I make a default button work in Windows CE 6.0?

Posted on 2009-12-29
12
1,032 Views
Last Modified: 2013-12-21
I am unable to make default buttons work in my WinCE 6.0 applications.  This is a re-compile of an application which has worked without issue on WinCE versions 3-5.  I compiled with Embedded Visual tools for CE versions 3-5.  I switched over to Visual Studio 2008 for the CE6 build.

I even took an application which was compiled for CE3, executed it on my CE6 device, and the default button still does not work.  This same CE3 executable works without issue on CE4 and CE5.

The applications are written in C++ with MFC.
0
Comment
Question by:neptuneit
  • 5
  • 3
  • 2
  • +1
12 Comments
 
LVL 33

Expert Comment

by:pgnatyuk
Comment Utility
"default buttons work" - What do you mean?
On a dialog you have Ok/Cancel and these buttons do not work? Button just send WM_COMMAND to the dialog.
Or you are asking about "Ok" button in the right upper corner? Or buttons in the command bar? The application is full screen?
Check with the emulator - you can debug and see what's going on.
0
 
LVL 1

Author Comment

by:neptuneit
Comment Utility
I have an edit box which is setup to not accept the ENTER key.  I have 2 buttons on the screen and one is setup as "DEFAULT BUTTON" in the resource.  Pressing the ENTER key in the edit box normally presses the button marked as "DEFAULT BUTTON".  This is the case on WinCE 3-5.  On WinCE6 nothing happens when the ENTER button is pressed.
0
 
LVL 24

Expert Comment

by:alexey_gusev
Comment Utility
don't know if this is related, but Microsoft removed DS_MODALFRAME style in MFC8.0, so maybe that's the reason it doesn't work.

I assume the "Default button" property is set to True in Resource Editor for that button ;)
0
 
LVL 1

Author Comment

by:neptuneit
Comment Utility
This is a modal dialog with a style of POPUP.  I have many of these types of dialogs throughout my application and they all behave the same way.  The "Default button" property is set.
0
 
LVL 33

Expert Comment

by:pgnatyuk
Comment Utility
How you press Enter?
Maybe this is the question?

Can you put a TRACE or a message not that will jump when you press ion Enter? You know that the edit box receives WM_CHAR, WM_KEYDOWN and WM_KEYUP, so you may handle these messages.

This "default" button is just a focus set on a specific button when the application starts up. So set focus on the button in OnInitDialog and it will solve the question.

Also you can build your project with an "old" SDK and check. For example with Pocket PC 2003.
0
 
LVL 1

Author Comment

by:neptuneit
Comment Utility
The default button is not just focus on a specific button.  It is the default button to use when the ENTER key is pressed.  If you are in a single line edit box, pressing the ENTER key should press the default button even if the default button does not have focus.  This does not seem to work on my CE6 device.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 33

Expert Comment

by:pgnatyuk
Comment Utility
Do you know how to make any button react on Enter when the focus is in the editbox? Add OnButtonKeyDown handler to you dialog, when this message came from the editbox, call the method responsible for the button or send WM_COMMAND from this button. That will solve the question.

I think there is no problem with the default buttons on WinCE 6 itself. I have a device with Windows CE 6, there is no hardware keyboard to test, but I can use this "virtual" keyboard, if you will insist. :)

It's not because I'm lazy. It's because I'd prefer to add this keydown handler and do not depend on a default button.

0
 
LVL 1

Author Comment

by:neptuneit
Comment Utility
Maybe I'm not stressing this enough, but this exact same code/executable works on CE3-CE5.  Only on CE6 does the ENTER key not auto push the default button when focus is on the CEdit control.
0
 
LVL 24

Expert Comment

by:alexey_gusev
Comment Utility
do you mean exactly the same binaries or just the code that you compile for CE3-5 and CE6? if the latter then check MFC sources for how it handles 'default button' thingy
0
 
LVL 1

Author Comment

by:neptuneit
Comment Utility
I have tried the exact same binary which worked on CE3-CE5.  I also re-compiled the code for CE6.  Both methods resulted in the same issue with the default buttons not working.

Does anybody know if the default button functionality was removed from WinCE6?  I heard something about Windows Mobile and WinCE was merged with WinCE6.
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
Is it an owner-draw button? If so, see if (as a test) using a regular (non-ownerdrawn) button's "defaultness" works correctly.
Is it a button that you crate at runtime or one that you put on a dilaog box using the dialog editor?
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 500 total points
Comment Utility
Also:
Slap Spy++ in the various windows.  This is almost certainly related to an unwanted / modified handling of the  WM_GETDLGCODE message.  Some background about that is here:
    http://support.microsoft.com/kb/83302
and here:
   COddButton
    http://www.codeproject.com/KB/buttons/oddbutton.aspx
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Several part series to implement Internet Explorer 11 Enterprise Mode
You should read OS supplied guidelines before developing. I can't stress that enough. The guidelines will help you understand the reasons mobile app developers do what they do.  Apple is very particular when they review appstore submissions.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now