Solved

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

Posted on 2004-04-05
5
758 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 400 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Generic progress indicator 6 121
java ^ examples 8 75
wordappend challenge 8 249
Problem to open Excel file 15 266
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 …
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

751 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