www.digitalmars.com         C & C++   DMDScript  

c++.wxwindows - Need some clarification please

reply "Julie M. Holton" <mommyof5 sbcglobal.net> writes:
Hello all,

It is me again, the big dreamer.  I have a couple of questions.

1.  Are there no properties in c++?

This would look like a classic case for a property  (from menuitem.h)

// state
    virtual void Enable(bool enable = TRUE) { m_isEnabled = enable; }
    virtual bool IsEnabled() const { return m_isEnabled; }

Couldn't I do something like this?

// state
    bool Enable()
    {
        put (bool value)
       {
          m_isEnabled = value;
       }
       get
      {
         return m_isEnabled;
      }
    }

2.  Should I ever use "?"

I have been reading the "" and it says to not use the ? with objects

    wxString s = s1.Len() < s2.Len() ? s1 : s2;

    Becomes

    wxString s;
    if ( s1.Len() < s2.Len() )
        s = s1;
    else
        s = s2;

    btw, shouldn't it actually be

    wxString s;
    if ( s1.Len() < s2.Len() )
    {
        s = s1;
    }
    else
    {
        s = s2;
     }

    Or is that nit picking?

    anyway the question remains, should I just always use the latter style?


3.  Finally (for now, sorry guys)  while looking over the wxWizard sample...

I noticed that the wxRadioboxPage which is derived from the
wxWizardPageSimple class handles the OnWizardCancel() event as does the rest
of the application, however;  it doesn't tell MyFrame that the cancel has
occured.  wxWizardPageSimple seems to be derived from wxWizardPage (which
does as expected), how do I raise the event higher up?


Thanks in advance
Sep 25 2003
next sibling parent "Charles Sanders" <sanders-consulting comcast.net> writes:
 1.  Are there no properties in c++?

Nope.
 2.  Should I ever use "?"

I use it all the time, the ternary operator rocks!
     btw, shouldn't it actually be
 ....

If you dont use curly braces, then the statement follownig the if / else statement is the only one that gets executed. if ( Julie == "Big Dreamer") StudyHard();
 I noticed that the wxRadioboxPage which is derived from the
 wxWizardPageSimple class handles the OnWizardCancel() event as does the

 of the application, however;  it doesn't tell MyFrame that the cancel has
 occured.  wxWizardPageSimple seems to be derived from wxWizardPage (which
 does as expected), how do I raise the event higher up?

Not sure what you mean here ? You have a derived class that captures the event , and you want to set it up to the bsae class ? C "Julie M. Holton" <mommyof5 sbcglobal.net> wrote in message news:bkvb11$1dok$1 digitaldaemon.com...
 Hello all,

 It is me again, the big dreamer.  I have a couple of questions.

 1.  Are there no properties in c++?

 This would look like a classic case for a property  (from menuitem.h)

 // state
     virtual void Enable(bool enable = TRUE) { m_isEnabled = enable; }
     virtual bool IsEnabled() const { return m_isEnabled; }

 Couldn't I do something like this?

 // state
     bool Enable()
     {
         put (bool value)
        {
           m_isEnabled = value;
        }
        get
       {
          return m_isEnabled;
       }
     }

 2.  Should I ever use "?"

 I have been reading the "" and it says to not use the ? with objects

     wxString s = s1.Len() < s2.Len() ? s1 : s2;

     Becomes

     wxString s;
     if ( s1.Len() < s2.Len() )
         s = s1;
     else
         s = s2;

     btw, shouldn't it actually be

     wxString s;
     if ( s1.Len() < s2.Len() )
     {
         s = s1;
     }
     else
     {
         s = s2;
      }

     Or is that nit picking?

     anyway the question remains, should I just always use the latter

 3.  Finally (for now, sorry guys)  while looking over the wxWizard

 I noticed that the wxRadioboxPage which is derived from the
 wxWizardPageSimple class handles the OnWizardCancel() event as does the

 of the application, however;  it doesn't tell MyFrame that the cancel has
 occured.  wxWizardPageSimple seems to be derived from wxWizardPage (which
 does as expected), how do I raise the event higher up?


 Thanks in advance

Sep 25 2003
prev sibling parent chris elliott <biol75 york.ac.uk> writes:
Julie M. Holton wrote:

 Hello all,
 

 I noticed that the wxRadioboxPage which is derived from the
 wxWizardPageSimple class handles the OnWizardCancel() event as does the rest
 of the application, however;  it doesn't tell MyFrame that the cancel has
 occured.  wxWizardPageSimple seems to be derived from wxWizardPage (which
 does as expected), how do I raise the event higher up?

either save a pointer to the wizeard and do mywizard->myfunction(event); or GetParent()->AddPendingEvent (event) ?? chris
 
 
 Thanks in advance
 
 

Sep 26 2003