Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to maintain the button in pressed state

How to maintain the button in pressed state

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
8 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    chetan210183
    wrote on last edited by
    #1

    HI, Thanks In Advance. I am creating a Dialog Based Application for getting the current Time and displaying the time in the Edit Box. I got it using COleDateTime class. But i want to get the seconds Edit Box to be Updated continuously.I mean the application to be in running state. void CTimeDlg::OnTime() { COleDateTime d,t; d = t.GetCurrentTime(); m_hour = d.GetHour(); m_min = d.GetMinute(); m_sec = d.GetSecond(); UpdateData(FALSE); // I tried the below line but in vain. // I realized that OnTime() method is BN_CLICKED event OnTime(); } Here i want to call the OnTime() method repeatedly. Is it possible to do so? Helping others satisfies you...

    N S M 3 Replies Last reply
    0
    • C chetan210183

      HI, Thanks In Advance. I am creating a Dialog Based Application for getting the current Time and displaying the time in the Edit Box. I got it using COleDateTime class. But i want to get the seconds Edit Box to be Updated continuously.I mean the application to be in running state. void CTimeDlg::OnTime() { COleDateTime d,t; d = t.GetCurrentTime(); m_hour = d.GetHour(); m_min = d.GetMinute(); m_sec = d.GetSecond(); UpdateData(FALSE); // I tried the below line but in vain. // I realized that OnTime() method is BN_CLICKED event OnTime(); } Here i want to call the OnTime() method repeatedly. Is it possible to do so? Helping others satisfies you...

      N Offline
      N Offline
      Nibu babu thomas
      wrote on last edited by
      #2

      Here is an AutoRepeat Button From Joseph M. Newcomer[^]


      Nibu thomas Software Developer

      1 Reply Last reply
      0
      • C chetan210183

        HI, Thanks In Advance. I am creating a Dialog Based Application for getting the current Time and displaying the time in the Edit Box. I got it using COleDateTime class. But i want to get the seconds Edit Box to be Updated continuously.I mean the application to be in running state. void CTimeDlg::OnTime() { COleDateTime d,t; d = t.GetCurrentTime(); m_hour = d.GetHour(); m_min = d.GetMinute(); m_sec = d.GetSecond(); UpdateData(FALSE); // I tried the below line but in vain. // I realized that OnTime() method is BN_CLICKED event OnTime(); } Here i want to call the OnTime() method repeatedly. Is it possible to do so? Helping others satisfies you...

        S Offline
        S Offline
        Stephen Hewitt
        wrote on last edited by
        #3

        Look up the SetTimer API - It should do the trick. Steve

        M 1 Reply Last reply
        0
        • C chetan210183

          HI, Thanks In Advance. I am creating a Dialog Based Application for getting the current Time and displaying the time in the Edit Box. I got it using COleDateTime class. But i want to get the seconds Edit Box to be Updated continuously.I mean the application to be in running state. void CTimeDlg::OnTime() { COleDateTime d,t; d = t.GetCurrentTime(); m_hour = d.GetHour(); m_min = d.GetMinute(); m_sec = d.GetSecond(); UpdateData(FALSE); // I tried the below line but in vain. // I realized that OnTime() method is BN_CLICKED event OnTime(); } Here i want to call the OnTime() method repeatedly. Is it possible to do so? Helping others satisfies you...

          M Offline
          M Offline
          Monty2
          wrote on last edited by
          #4

          I think you want to display the current time in a EditBox Use SetTimer to Set a Timer preferable in OnInitDialog SetTimer(2500,1000,NULL); this is fire WM_TIMER every second Use ClassWizard to handle WM_TIMER message .....::OnTimer(UINT nIDEvent) { //Calculate the current time //Use SetWindowText instead of UpdateData for Performance reasons CDialog::OnTimer(nIdEvent); } This is probably not the best way (cause of the delays) but will work Hope it helps


          C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

          C 1 Reply Last reply
          0
          • S Stephen Hewitt

            Look up the SetTimer API - It should do the trick. Steve

            M Offline
            M Offline
            Monty2
            wrote on last edited by
            #5

            beat me to it :-D


            C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

            S 1 Reply Last reply
            0
            • M Monty2

              beat me to it :-D


              C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

              S Offline
              S Offline
              Stephen Hewitt
              wrote on last edited by
              #6

              Yeah, but you went into more detail - I was going to but I was too lazy. Steve

              M 1 Reply Last reply
              0
              • S Stephen Hewitt

                Yeah, but you went into more detail - I was going to but I was too lazy. Steve

                M Offline
                M Offline
                Monty2
                wrote on last edited by
                #7

                Stephen Hewitt wrote:

                I was going to but I was too lazy

                Nah generally you are not, you helped me a lot in the ATL forum thanks :rose:


                C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

                1 Reply Last reply
                0
                • M Monty2

                  I think you want to display the current time in a EditBox Use SetTimer to Set a Timer preferable in OnInitDialog SetTimer(2500,1000,NULL); this is fire WM_TIMER every second Use ClassWizard to handle WM_TIMER message .....::OnTimer(UINT nIDEvent) { //Calculate the current time //Use SetWindowText instead of UpdateData for Performance reasons CDialog::OnTimer(nIdEvent); } This is probably not the best way (cause of the delays) but will work Hope it helps


                  C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg

                  C Offline
                  C Offline
                  chetan210183
                  wrote on last edited by
                  #8

                  WonderFull!!!! it is working. Thanks a lot. Helping others satisfies you...

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups