Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Contributor
kuroberry
Posts: 30
Registered: ‎02-05-2013
My Device: Dev Alpha B
My Carrier: maxis

closing Dialog

Hi guys, I'm trying to close/disconnect the dialog. However I can't seem to find any function to be used from inside the class. Therefore upon triggering timeout(Qtimer) the app will logout, however the dialog still linger until clicked upon.   

The ones I'm using are AlertDialog class along with Dialog. tried using Dialog.cpp destroyDialog()  but still cannot be closed. 

link: https://github.com/blackberry/Cascades-Samples/tree/master/DialogSample/src

 

Any help is appreciated. Thanks

Please use plain text.
Developer
simon_hain
Posts: 16,018
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: closing Dialog

did you try https://developer.blackberry.com/cascades/reference/bb__cascades__dialog.html#function-close
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Developer
zezke
Posts: 1,004
Registered: ‎12-12-2010
My Device: Z10 (red Limited Edition)
My Carrier: Mobile Vikings

Re: closing Dialog

Can you show your code? Normally I use cancel() if I recall correctly.

-------------------------------------------
BlackBerry Certified Builder for Native Application Development -- Proud member of the Belgian BlackBerry Developer group
Samples: Park in Ghent
Feeling generous? Nominate me for BB Elite member!
Please use plain text.
Contributor
kuroberry
Posts: 30
Registered: ‎02-05-2013
My Device: Dev Alpha B
My Carrier: maxis

Re: closing Dialog

I could close default systemprompt using cancel(), and default dialog using close() but not AlertDialog class. The code I'm using is pretty much the same with the one on github sample with only a little addition in AlertDialog class, a close() that I add myself. 

 

AlertDialog.cpp

...

void AlertDialog::close() { qDebug() << "===alertDialogclose==="; destroyDialog(); }

 

Any Ideas?

 

 

 

Please use plain text.
Developer
rcebryk
Posts: 84
Registered: ‎12-01-2012
My Device: 9790
My Carrier: Orange

Re: closing Dialog

Do you have Dialog object inside AlertDialog object or do you inherit it? Please show your declaration of AlertDialog class (from the AlertDialog.hpp file)

Lublin BlackBerry Developer Group


---
If I helped you please mark my response as solution or "Like" it.
Please use plain text.
Contributor
kuroberry
Posts: 30
Registered: ‎02-05-2013
My Device: Dev Alpha B
My Carrier: maxis

Re: closing Dialog

Hi, Here it is

 

AlertDialog.hpp

#ifndef ALERTDIALOG_HPP_
#define ALERTDIALOG_HPP_

#include "Dialog.hpp"

class AlertDialog : public Dialog
{
    Q_OBJECT

    /*
     * QML exposed property for the alert message
     */
    Q_PROPERTY(QString alertMessage READ getAlertMessage WRITE setAlertMessage)

    Q_PROPERTY(bool opened READ opened NOTIFY filterChanged)
public:
    /*
     * Ctor & Dtor
     */
    AlertDialog(QObject* parent = 0);
    virtual ~AlertDialog();

signals:
	void filterChanged();
public:
    /*
     * Getter and Setter for alert message
     */
    QString getAlertMessage() const;
    bool opened () const;
    void setAlertMessage(QString const& value);

    Q_INVOKABLE
    void close();

    bool shutdown;

protected:
    /*
     * Implements the run loop. The dialog stays open until a button is clicked.
     */
    virtual void run();

protected:
    QString m_alertMessage;
    bool m_opened;
};

#endif /* ALERTDIALOG_HPP_ */

 

Please use plain text.
Developer
simon_hain
Posts: 16,018
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: closing Dialog

why do you overwrite the close method at all? as you extend Dialog you already have a Q_INVOKABLE close method that closes the dialog.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Contributor
kuroberry
Posts: 30
Registered: ‎02-05-2013
My Device: Dev Alpha B
My Carrier: maxis

Re: closing Dialog

It's because I have tried directly using close() already before writing it myself, and it's not working.

 

regards.

Please use plain text.