Solved

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

Posted on 2009-12-29
12
1,055 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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
 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This is an article about Leadership and accepting and adapting to new challenges. It focuses mostly on upgrading to Windows 10.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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). …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

815 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

8 Experts available now in Live!

Get 1:1 Help Now