Disable NEXT button a wizard property sheet 
Author Message
 Disable NEXT button a wizard property sheet

Hi all,

We know we have "PSWIZB_DISABLEDFINISH" that disable Finish button for a
wizard property sheet.
I need a Next button, but I want to disable it before a textbox is filled
something.
I have used EnableWindow(FALSE) with that button, it does not work, any way
to solve it?

Thanks in advance,

Siman



Mon, 23 May 2005 00:19:53 GMT  
 Disable NEXT button a wizard property sheet
    Take a look at the SetWizardButtons() member function.

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------


Quote:
> Hi all,

> We know we have "PSWIZB_DISABLEDFINISH" that disable Finish button for a
> wizard property sheet.
> I need a Next button, but I want to disable it before a textbox is filled
> something.
> I have used EnableWindow(FALSE) with that button, it does not work, any
way
> to solve it?

> Thanks in advance,

> Siman



Mon, 23 May 2005 01:59:38 GMT  
 Disable NEXT button a wizard property sheet

Quote:
>We know we have "PSWIZB_DISABLEDFINISH" that disable Finish button for a
>wizard property sheet.
>I need a Next button, but I want to disable it before a textbox is filled
>something.

Siman,

Have you tried (not) using the corresponding PSWIZB_NEXT option to
CPropertySheet::SetWizardButtons?

Dave
--
MVP VC++ FAQ: http://www.mvps.org/vcfaq



Mon, 23 May 2005 01:52:24 GMT  
 Disable NEXT button a wizard property sheet
Thanks for quick reply, Dave.

Here is the code I am running:

BOOL CNewSheetPage::OnSetActive()
{
  m_sheet->SetWizardButtons( PSWIZB_NEXT );

 if ( m_sText == _T("") )    // if empty, disable NEXT button, wait for name
filled
 {
  // disable Next button -- this button is Wizard button, does not works
  CWnd* pWnd = m_sheet->GetDlgItem(ID_WIZNEXT);
  pWnd->EnableWindow(FALSE);

  // disable Comment button -- this button is user defined button, works
  pWnd = GetDlgItem(IDC_NEW_PAGE_COMMENT);
  pWnd->EnableWindow(FALSE);
 }
....
return CPropertyPage::OnSetActive();

Quote:
}

It looks like MFC reset EnableWindow(FALSE) after return from OnSetActive

Any hint here ?

Thanks a lot.

Siman


Quote:
> >We know we have "PSWIZB_DISABLEDFINISH" that disable Finish button for a
> >wizard property sheet.
> >I need a Next button, but I want to disable it before a textbox is filled
> >something.

> Siman,

> Have you tried (not) using the corresponding PSWIZB_NEXT option to
> CPropertySheet::SetWizardButtons?

> Dave
> --
> MVP VC++ FAQ: http://www.mvps.org/vcfaq



Mon, 23 May 2005 05:41:42 GMT  
 Disable NEXT button a wizard property sheet
Thanks for you reply.

I checked the SetWizardButtons() member function, however I can not find
what I want, here is summary:
 The SetWizardButtons() function can have the following flags:

    SetWizardButtons(PSWIZB_NEXT) Disables the Back button and
enables the Next button.

    SetWizardButtons(PSWIZB_BACK) Disables the Next button and
enables the Back button.

    SetWizardButtons(PSWIZB_FINISH) Disables the Back button, and
replaces the Next button with an enabled Finish button

    SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT) Enables both the
Back and Next Buttons

    SetWizardButtons(PSWIZB_BACK | PSWIZB_FINISH) Enables both
the Back and Finish Buttons

    SetWizardButtons(PSWIZB_BACK | PSWIZB_DISABLEDFINISH) Enables
the Back and displays a disabled Finish button instead of the Next button.

The PSWIZB_NEXT and PSWIZB_FINISH flags cannot be used together, because
they both use the same button position.

Something I missed ?

Thanks very much,

Siman


Quote:
>     Take a look at the SetWizardButtons() member function.

> --
> Cheers
> Check Abdoul [ VC++ MVP ]
> -----------------------------------



> > Hi all,

> > We know we have "PSWIZB_DISABLEDFINISH" that disable Finish button for a
> > wizard property sheet.
> > I need a Next button, but I want to disable it before a textbox is
filled
> > something.
> > I have used EnableWindow(FALSE) with that button, it does not work, any
> way
> > to solve it?

> > Thanks in advance,

> > Siman



Mon, 23 May 2005 05:50:46 GMT  
 Disable NEXT button a wizard property sheet
As you have mentioned in detail, use this function in your OnSetActive()
instead of the GetDlgItem()+EnableWindow() combo.

For example

BOOL CNewSheetPage::OnSetActive()
{
  m_sheet->SetWizardButtons( PSWIZB_NEXT );

    if ( m_sText == _T("") )    // if empty, disable NEXT button, wait for
name...
    {
        // disable Next button --
        m_sheet->SetWizardButtons( PSWIZB_BACK );   // or
m_sheet->SetWizardButtons( 0 ); if you do not want the BACK button.
        ....
    }

        or I believe you should be able to use the
GetDlgItem()+EnableWindow() combo in your OnInitDialog() instead of
OnSetActive().

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------


Quote:
> Thanks for you reply.

> I checked the SetWizardButtons() member function, however I can not find
> what I want, here is summary:
>  The SetWizardButtons() function can have the following flags:

>     SetWizardButtons(PSWIZB_NEXT) Disables the Back button and
> enables the Next button.

>     SetWizardButtons(PSWIZB_BACK) Disables the Next button and
> enables the Back button.

>     SetWizardButtons(PSWIZB_FINISH) Disables the Back button, and
> replaces the Next button with an enabled Finish button

>     SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT) Enables both the
> Back and Next Buttons

>     SetWizardButtons(PSWIZB_BACK | PSWIZB_FINISH) Enables both
> the Back and Finish Buttons

>     SetWizardButtons(PSWIZB_BACK | PSWIZB_DISABLEDFINISH) Enables
> the Back and displays a disabled Finish button instead of the Next button.

> The PSWIZB_NEXT and PSWIZB_FINISH flags cannot be used together, because
> they both use the same button position.

> Something I missed ?

> Thanks very much,

> Siman



> >     Take a look at the SetWizardButtons() member function.

> > --
> > Cheers
> > Check Abdoul [ VC++ MVP ]
> > -----------------------------------



> > > Hi all,

> > > We know we have "PSWIZB_DISABLEDFINISH" that disable Finish button for
a
> > > wizard property sheet.
> > > I need a Next button, but I want to disable it before a textbox is
> filled
> > > something.
> > > I have used EnableWindow(FALSE) with that button, it does not work,
any
> > way
> > > to solve it?

> > > Thanks in advance,

> > > Siman



Mon, 23 May 2005 06:15:02 GMT  
 Disable NEXT button a wizard property sheet
Got it!
Thanks a lot, the key point is:
m_sheet->SetWizardButtons( 0 );  which I did miss it. :-)
I need BACK button disabled to keep (page format)consistent with next page.

Thanks again,

Siman


Quote:
> As you have mentioned in detail, use this function in your OnSetActive()
> instead of the GetDlgItem()+EnableWindow() combo.

> For example

> BOOL CNewSheetPage::OnSetActive()
> {
>   m_sheet->SetWizardButtons( PSWIZB_NEXT );

>     if ( m_sText == _T("") )    // if empty, disable NEXT button, wait for
> name...
>     {
>         // disable Next button --
>         m_sheet->SetWizardButtons( PSWIZB_BACK );   // or
> m_sheet->SetWizardButtons( 0 ); if you do not want the BACK button.
>         ....
>     }

>         or I believe you should be able to use the
> GetDlgItem()+EnableWindow() combo in your OnInitDialog() instead of
> OnSetActive().

> --
> Cheers
> Check Abdoul [ VC++ MVP ]
> -----------------------------------



Mon, 23 May 2005 06:34:57 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Property Sheet (wizard)- Next goes to previous page

2. Help Button on Property Sheet Wizard

3. Help button in property sheet wizard

4. Done button during property sheet wizard

5. property sheet wizard - using Help button to throw modal dialog and not use .HLP

6. Wizard/Property Sheet buttons

7. Disabling defaultness of property sheet buttons

8. Disabling defaultness of property sheet buttons

9. Unable to disable/enable buttons on property sheet

10. Owner draw button in replacement of the next/back button in a CPropertySheet in Wizard mode

11. Creating Property Sheets and Property Pages w/o the Class Wizard

12. How to disable property page on property sheet.

 

 
Powered by phpBB® Forum Software