Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Intercept OK button in TPropertySheet

Posted on 1997-10-06
10
Medium Priority
?
346 Views
Last Modified: 2013-12-26
Hi World

Does any body know how to intercept OK Button in TPropertySheet ? I've tried CloseWindow and CanClose but witout a result.
Thanks for your help
0
Comment
Question by:dreynier
[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
  • 6
  • 3
10 Comments
 

Expert Comment

by:djfr
ID: 1299421
Define a Response function in your Property Sheets' response table like so:

DEFINE_RESPONSE_TABLE1(MyPropertySheetClass, TPropertySheet)

EV_COMMAND_AND_ID(IDOK, HandleOkButton),

END_RESPONSE_TABLE;

The handler would look like:

void TMyPropertySheetClass::HandleOkButton(WPARAM wParam)
{
    switch(wParam)
    {
        case IDOK:
            // do something.....
            Apply();
           
            break;
    }
}

Property Sheets aren't easy.  I have a paper on them somewhere...

Hope this helps:-)

DJF



0
 

Author Comment

by:dreynier
ID: 1299422
Thanks for your answer

...Before asking for help, I've tried to define a Reponse function but whith a wrong parameter type ( my french documentation is ::HandleFunction(uint param) and not HandleFunction(WPARAM param) )
I've tried your example but I still can't intercept OK Button

I've set a Breakpoint on the response function but the application never stop at this point

Here is a part of my code

class TCenteredPropertySheet : public TPropertySheet
  {
  public:
    TCenteredPropertySheet(TWindow* parent, char* title, int startPage = 0, bool isWizard = false, uint32 flag = SH_DEFAULT );

  protected:
    void           SetupWindow();
    void           ButtonClicked(WPARAM param);      

  public:
    DECLARE_RESPONSE_TABLE(TCenteredPropertySheet);
  };

DEFINE_RESPONSE_TABLE1( TCenteredPropertySheet, TPropertySheet)
EV_COMMAND_AND_ID(IDOK, ButtonClicked),
END_RESPONSE_TABLE;


TCenteredPropertySheet::TCenteredPropertySheet( TWindow* parent, char* title, int startPage,                                              bool isWizard, uint32 flag ):
TPropertySheet( parent, title, startPage, isWizard, flag )
  {

  }


void TCenteredPropertySheet::SetupWindow()
  {
  TPropertySheet::SetupWindow();
  TRect rc;
  GetWindowRect( rc );
  TScreenDC dc;
  int nX = dc.GetDeviceCaps(HORZRES) / 2 - rc.Width() / 2;
  int nY = dc.GetDeviceCaps(VERTRES) / 2 - rc.Height() / 2;
  SetWindowPos( HWND_TOP, nX, nY, 0, 0, SWP_NOSIZE );
  }


void TCenteredPropertySheet::ButtonClicked(WPARAM param)
  {
  if( param == IDOK )
    CheckAllPage();
  }
            

I really don't understand why !!!
      

0
 

Expert Comment

by:djfr
ID: 1299423
Are you calling EnableSubclass(true); in the constructor of your Property Sheet?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:dreynier
ID: 1299424
Hi

Thanks a lot for your help
That was the good answer I can now intercept Ok
You talk about a paper on Property Sheets in your previous answer and I'm really interrested to get that paper if it is posible..
Never mind your answer is Ok and I give you a good rate

Daniel

0
 

Author Comment

by:dreynier
ID: 1299425
Hi

Thanks a lot for your help
That was the good answer I can now intercept Ok
You talk about a paper on Property Sheets in your previous answer and I'm really interrested to get that paper if it is posible..

Never mind your answer is Ok and I give you a good rate

Daniel

0
 

Expert Comment

by:djfr
ID: 1299426
Thanks for your comment, I appreciate it.  Send me a mail at djfrazier@vendata.com, I'll see if I can dig up the paper somewhere.
0
 

Expert Comment

by:djfr
ID: 1299427
Please Grade!
0
 

Accepted Solution

by:
djfr earned 300 total points
ID: 1299428
I answered your question.  Please grade!

djfr
0
 
LVL 3

Expert Comment

by:LucHoltkamp
ID: 1299429
What the F... is EnableSubclass ??? I grepped my entire set of includefiles, but there is no EnableSubclass.
Furthermore, why don't you use EV_COMMAND instead of EV_COMMAND_AND_ID.
please djfr help me!!
.luc.  
0
 

Expert Comment

by:djfr
ID: 1299430
What version of the Borland compiler are you running with?  I am using 5.02.  If your version is pre 5.x, I don't believe you'll find it.  The reason I use EV_COMMAND_AND_ID is so that I can have one function that handles multiple WM_COMMAND messages.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

604 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