FRAGE ZÄHLSCHLEIFE



  • HALLO LEUTE
    WER KANN MIR HELFEN EINE ZÄHLSCHLEIFE ZU ERSTELLEN, DIE BEIM KLICK AUF DEN MENÜPUNKT START, DIE LABELS ANGEFANGEN BEI 1 DANN 2 DANN 3 DANN 4 ANZEIGT(EINE SEKUNDE) UND DANN STOPPT. DIE BETREFFENDE CODESTELLE IST DURCH /************/GEKENNZEICHNET!!!
    DER REST KLAPPT SUPER
    DAS IST SEHR WICHTIG FÜR MICH

    class __Form1_declspec Form1 : public __Form1_Base
    {
    
        public:
            // add your public instance data here
    
        private:
             WBool _Set_Text(void); // add your private instance data here
             WInt _text_nr;
             WInt _um1;
    
        protected:
            // add your protected instance data here
    
    };
    
    // Code added here will be included at the top of the .CPP file
     WBool Form1::_Set_Text(void)
     {
    
        _um1=(_um1+1)%4;
    
      switch (_um1)
        {
         case 0:
               label_1->SetText( "1 Text Position" );
               label_2->SetText( " " );
               label_3->SetText( " " );
               label_4->SetText( " " );
           break;
           case 1:
    
                label_1->SetText( "" );
                label_2->SetText( "2 Text Position " );
                label_3->SetText( "" );
                label_4->SetText( " " );
    
           break;
          case 2:
    
               label_1->SetText( "" );
               label_2->SetText( "" );
               label_3->SetText( "  3 Text Position " );
               label_4->SetText( "  " );
    
          break;
           case 3:
    
                label_1->SetText( " " );
                label_2->SetText( " " );
                label_3->SetText( " " );
                label_4->SetText( "4 Text Position " );
    
          break; 
    
        }
      return FALSE;
       }
    
    //  Include definitions for resources.
    #include "WRes.h"
    
    Form1::Form1()
    {
     _text_nr = 0;
    
    }
    
    Form1::~Form1()
    {
    
    }
    
    WBool Form1::menu_1_ErstePosition_Click(
        WObject *           source,
        WEventData *        event )
    {
               label_1->SetText( "1 Text Position " );
               label_2->SetText( " " );
               label_3->SetText( " " );
               label_4->SetText( " " );
                 if (_text_nr == 0 ) 
    { _um1 = 0;}
        return FALSE;
    }
    
    WBool Form1::menu_1_ZweitePosition_Click(
        WObject *           source,
        WEventData *        event )
    {
                label_1->SetText( " " );
                label_2->SetText( "2 Text Position " );
                label_3->SetText( " " );
                label_4->SetText( " " );
            if (_text_nr == 0  ) 
    { _um1 = 1;}
        return FALSE;
    }
    
    WBool Form1::menu_1_DrittePosition_Click(
        WObject *           source,
        WEventData *        event )
    {
                label_1->SetText( " " );
                label_2->SetText( " " );
                label_3->SetText( " 3 Text Position" );
                label_4->SetText( " " );
            if (_text_nr == 0 )  
    { _um1 = 2;}
        return FALSE;
    }
    
    WBool Form1::menu_1_ViertePosition_Click(
        WObject *           source,
        WEventData *        event )
    {
                label_1->SetText( " " );
                label_2->SetText( " " );
                label_3->SetText( " " );
                label_4->SetText( " 4 Text Position" ); 
            if (_text_nr == 0 ) 
                 {_um1 = 3; }
        return FALSE;
    }
    /* ************************************ */
    
    WBool Form1::menu_1_Start_Click(
        WObject *           source,
        WEventData *        event )
    {
    
        if (_text_nr == 0)
        _text_nr =1;
    
     _Set_Text();
    
    return FALSE;
    
    }
    /* *********************************  */
    
    WBool Form1::cb_1_Click(
        WObject *           source,
        WEventData *        event )
    {
    
    if (_text_nr == 1)
         _text_nr = 0;
    
    _Set_Text();
    
    return FALSE;
    
    }
    


  • 1. Was hat das ganze mit MFC zu tun?
    2. Kauf Dir mal eine neue Tastatur, die liefert nur noch Grossbuchstaben...
    3. Du brauchst einen Timer (SetTimer)


Anmelden zum Antworten