[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2009-12-29
12
Medium Priority
?
1,105 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
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). …
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Suggested Courses
Course of the Month17 days, 22 hours left to enroll

830 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