?
Solved

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

Posted on 2009-12-29
12
Medium Priority
?
1,094 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
ATEN's HDBaseT Presentation at InfoComm 2017

Hear ATEN Product Manager YT Liang review HDBaseT technology, highlighting ATEN’s latest solutions as they relate to real-world applications during her presentation at the HDBaseT booth at InfoComm 2017.

 
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

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
This article shows how to use a free utility called 'Parkdale' to easily test the performance and benchmark any Hard Drive(s) installed in your computer. We also look at RAM Disks and their speed comparisons.
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Suggested Courses
Course of the Month12 days, 7 hours left to enroll

777 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