Skip to main content
January 13, 2015
Answered

How to close dialog after pressed button

  • January 13, 2015
  • 1 reply
  • 499 views

Hi. I added button

ButtonWidget

(

  kButtonWidgetID,

  kSysButtonPMRsrcId,

  kBindNone,

  334, 16, 434, 16+24,

  kTrue, kTrue,

  kButtonLabelKey,

),

and in my method in file ...Observer.cpp

if (theChange == kTrueStateMessage)

  if (theSelectedWidget == kButtonWidgetID)

     //this I want close dialog

How? I don't want create CancelButtonWidget. This is must be cutom button.

This topic has been closed for replies.
Correct answer Norio Kawamura

Try this in your dialogObserver,

InterfacePtr<IWidgetParent> myParent(this, UseDefaultIID());

InterfacePtr<IDialog> dialog((IDialog*)myParent->QueryParentFor(IID_IDIALOG));

if (dialog) dialog->Close();

1 reply

Norio KawamuraCorrect answer
Inspiring
January 14, 2015

Try this in your dialogObserver,

InterfacePtr<IWidgetParent> myParent(this, UseDefaultIID());

InterfacePtr<IDialog> dialog((IDialog*)myParent->QueryParentFor(IID_IDIALOG));

if (dialog) dialog->Close();

January 14, 2015

Great. Very thanks. It's works. I'm new in SDK.

Inspiring
January 27, 2015

You can use CloseDialog(); in your dialogObserver instead of the previous code.