Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to set default button property at run time in form view application

Posted on 2004-04-05
5
Medium Priority
?
771 Views
Last Modified: 2013-11-20
Hi All,

I have a FormView application,Form view contains 2 buttons(IDOK and IDC_BUTTON_XXX).
i want to change Default button propety at runtime.how to do this in Form view class.

pls tel l me how to do this...?


Thanks in Advance...
0
Comment
Question by:SRaghunandan
[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
  • 3
5 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10755682
CButton::SetButtonStyle

use this to set the BS_DEFPUSHBUTTON   style
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10755732
That should set the style.  To make certain that an enter key press performs the button action then code such as the following is useful

BOOL CMyPropertyPage1::PreTranslateMessage(MSG* pMsg)
{
    if(pMsg->message == WM_KEYDOWN)
      {
            long nID = ::GetDlgCtrlID(pMsg->hwnd);
            if(pMsg->wParam == VK_RETURN)
            {
                  switch (nID)
                  {
                  case IDC_BTN_SAVE:
                        OnBtnSave();
                        return true;
0
 

Author Comment

by:SRaghunandan
ID: 10763901
my form view dont have any default button.when i try to set button style as BS_DEFPUSHBUTTON at run time the property is not getting set.what is the reason..?
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 800 total points
ID: 10764133
This works by me

      CButton* pButton = (CButton*)GetDlgItem(IDC_BUTTON1);
      UINT i = pButton->GetButtonStyle();
      i |= BS_DEFPUSHBUTTON;
      pButton->SetButtonStyle(i);
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

688 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