A way to point a progress bar to a specific time?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: A way to point a progress bar to a specific time?

  1. #1
    Join Date
    Mar 2012
    Posts
    13

    A way to point a progress bar to a specific time?

    Hello all,

    So I wondered if it is able to point a progressbar to a specific amount of time.
    For example:

    Start date: 10-01-2012
    Current date: 15-01-2012
    Finish date: 20-01-2012

    So the progress bar's current value is 50% because we're half way of days.
    I think this is the best explanation I can give.

    Thanks

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,634

    Re: A way to point a progress bar to a specific time?

    Sure, just use PBM_SETRANGE to assign an interval that fits your need (days/hours or some other choice) and then use PBM_SETPOS to adjust it. You can also use the step functionality.

    See http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  3. #3
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,120

    Re: A way to point a progress bar to a specific time?

    Quote Originally Posted by Miraclezz View Post
    Hello all,

    So I wondered if it is able to point a progressbar to a specific amount of time.
    For example:

    Start date: 10-01-2012
    Current date: 15-01-2012
    Finish date: 20-01-2012

    So the progress bar's current value is 50% because we're half way of days.
    I think this is the best explanation I can give.

    Thanks
    What would be the alternative? Progress bars would set their position randomly? Of course you can position it wherever you want. Did you read the documentation?

  4. #4
    Join Date
    Mar 2012
    Posts
    13

    Re: A way to point a progress bar to a specific time?

    Quote Originally Posted by GCDEF View Post
    What would be the alternative? Progress bars would set their position randomly? Of course you can position it wherever you want. Did you read the documentation?
    You mean I read this? : http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx ?

    Yes I did, but I didn't become wiser.
    I need some examples if it's possible.

    Start: 10-01-2012 00:00:00
    Current: 15-01-2012 12:00:00
    Finish: 20-01-2012 00:00:00

  5. #5
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,634

    Re: A way to point a progress bar to a specific time?

    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,120

    Re: A way to point a progress bar to a specific time?

    Quote Originally Posted by S_M_A View Post
    And particularly here
    and here

    If you're using MFC, you'll probably find the CProgressCtrl class easier.

  7. #7
    Join Date
    Mar 2012
    Posts
    13

    Re: A way to point a progress bar to a specific time?

    Mmm,

    This is the worst example.
    But how to decrease a current time with a time in, for example, a textbox.

    I have this 0,0


    String^ listViewDate = listView1->Items->SubItems[2]->Text;
    String^ DateAndTime = tsslDATEANDTIME->Text;

    int ProcessToGo = listViewDate - DateAndTime;

  8. #8
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,120

    Re: A way to point a progress bar to a specific time?

    Quote Originally Posted by Miraclezz View Post
    Mmm,

    This is the worst example.
    But how to decrease a current time with a time in, for example, a textbox.

    I have this 0,0


    String^ listViewDate = listView1->Items->SubItems[2]->Text;
    String^ DateAndTime = tsslDATEANDTIME->Text;

    int ProcessToGo = listViewDate - DateAndTime;
    That code isn't appropriate for this forum. You need one of the .net forums.

  9. #9
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,022

    Re: A way to point a progress bar to a specific time?

    Code:
    String^ listViewDate = listView1->Items->SubItems[2]->Text;
    String^ DateAndTime = tsslDATEANDTIME->Text;
    
    int ProcessToGo = listViewDate - DateAndTime;
    You need to convert DateAndTime string to some Date/Time type supporting subtraction operation. Then you calculate a time span in seconds or something. Having two time spans you can calculate the progress ratio.
    Best regards,
    Igor

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center