Solved

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

Posted on 2009-12-29
12
1,046 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
ID: 26140277
"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
ID: 26140305
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
ID: 26140384
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
ID: 26140402
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
ID: 26140685
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
ID: 26145226
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
Do email signature updates give you a headache?

Are you constantly making changes to email signatures? Are the images not formatting how you want them to? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today.

 
LVL 33

Expert Comment

by:pgnatyuk
ID: 26145433
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
ID: 26148783
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
ID: 26148931
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
ID: 26153757
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
ID: 26156136
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
ID: 26156224
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
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.

867 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

20 Experts available now in Live!

Get 1:1 Help Now