Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

no help button in CProperySheet

Status
Not open for further replies.

scienzia

Programmer
Feb 21, 2002
160
IT
I can't get rid of "?" button in my CPropertySheet

I was able to remove the "Apply" button with

sh.m_psh.dwFlags |= PSH_NOAPPLYNOW;

but this doesn't work:

sh.m_psh.dwFlags &= ~(PSH_HASHELP);

Is there something I should change inside the CPropertyPage elements?

I could also solve the problem by putting my CPropertySheet inside a dialog box, is there an "easy" way to do this?(I would use create instead of DoModal and I would have no buttons).
This solution would be even better because I could put even different buttons.
 
I use this all the time. The trick is that you need to modify the flag (PSH_HASHELP) for EACH property page (CPropertyPage) that you include in the property sheet (CPropertySheet.) You also must do this BEFORE calling DoModal();

Here's a quick code snippet example:

COptsSheet Opts("Your Property Sheet Title");
CPropertyPage myPage;

// Turn off the "HELP" button on the CPropertySheet.
Opts.m_psh.dwFlags &= ~PSH_HASHELP;

// Use this to get rid of the "Apply" button (if you want!)
// on the property sheet.
// You do not need to do this for each property page.
Opts.m_psh.dwFlags |= PSH_NOAPPLYNOW;

// You need to do this for EACH property page that you
// place in the proerty sheet (m_psp is a CPropertyPage
// member variable - see the documentation for details.)

myPage.m_psp.dwFlags &= ~PSP_HASHELP; // No "Help" Button!

// myPage.m_psp.dwFlags &= ~(PSP_HASHELP); will work also
// because ~ is a unary operator.

Opts.AddPage(&myPage);

Opts.DoModal();


Hope this helps. Happy coding! :)
*~-> EOR Candy <-~*
 
Thankyou very much!!!

How did you find out this?
It isn't explained in msdn and it looked as if the pages didn't count at all...
 
I found this out by applying DeMorgan's Law and/or boolean algebra (my memory is hazy on the specifics.)

This essentially says that:

&quot;A OR B&quot; and &quot;NOT A AND NOT B&quot; are logically equivalent so that if:

m_psp.dwFlags |= PSP_HASHELP

shows the help button

then the contrapositive

m_psp.dwFlags &= ~PSP_HASHELP

should hide the help button.


Look in any mathematics textbook that covers &quot;discrete mathematics&quot;, discusses boolean algebra and DeMorgan's Law if you wish to pursue the theory behind why this works.


Hope this helps! :)
*~-> EOR Candy <-~*
 
Another question....
is there an &quot;easy&quot; way to make the CProperty sheet be in a part of another window and not be modal?

Thanks in advance

PS I find programming the windows so confusing, I can manage programming c++, but I can't get the usage of windows, child windows, handles....

PPSS: if anyone knows about a manual that explains this staff (window programming) I would appreciate it very much.
 
I would imagine you would be able to use CreateDialog to create a modeless dialog but then you must be sure that OnCancel and OnOK do not call the respective base class member functions becuase these in turn will call EndModal which you do not want to happen with a modeless dialog.

In regard to Windows programming in general there are three books I would recommend without hesitation:

&quot;Programming Windows&quot; by Charles Petzold (get the latest edition) - This book is the de facto tome on Windows programming (though in C instead of C++) this book will teach you volumes about windows, child windows, handles, etc.

&quot;Programming Windows with MFC&quot; by Jeff Prosise (get the latest edition) - This book is in the same vein and spirit as the Petzold book but uses C++ and MFC.

&quot;Programming Microsoft Visual C++&quot; (get the latest edition) - This is another excellent MFC tutorial and teaching aid.


P.S. In answer to the obvious question, yes I purchased copies of all three books.


Hope this information helps! :)
*~-> EOR Candy <-~*
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top