Announcement

Collapse
No announcement yet.

DateTime_SetRange

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DateTime_SetRange

    Hi,

    I am trying to set the valid range (a month) to a calendar control. It works fine with the low date or with the high date, but I am unable to set a range (only days from a defined month are allowed). Can somebody point me in the right direction please?

    Code:
    LOCAL dt AS SYSTEMTIME
    control handle cbhndl, %IDC_BUDAT to hdp
    	if isfalse DateTime_SetRange (hdp, %GDTR_MIN, dt) then
    	   ? "Can't set min range"
    	end if 
     dt.wDay=VAL(right$(LastDay(sDate),2))
    	if isfalse DateTime_SetRange (hdp, %GDTR_MAX, dt) then
    	  ? "Max-Bereich kann nicht gesetzt werden"
    	end if
    Thanks in advance for your help
    rgds
    Werner

  • #2
    Without testing, I can just cite the SDK...
    GDTR_MIN
    The first [italics mine] element in the SYSTEMTIME structure array is valid and will be used to set the minimum allowable system time.

    GDTR_MAX
    The second element in the SYSTEMTIME structure array is valid and will be used to set the maximum allowable system time.
    i.e, I don't think MAX should be working the way you've coded it.

    But it appears you can do both in one shot...
    Code:
      LOCAL dt() AS SYSTEMTIME
     
     REDIM dt(1) 
     dt(0)   =   Minimum 
     dt(1)   =  Maximum 
     iret =  DateTime_setRange (hdp, %GDTR_MIN OR %GDTR_MAX, BYVAL VARPTR(dt(0))
    MCM
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      Thanks Michael,

      that works like a charme.

      rgds
      Werner

      Comment


      • #4
        Amazing.

        You and Good Things Happen.

        Anyone still wonder why I say "reading, understanding and applying the Microsoft Windows API documentation" is a skill all PB programmers should - no, must - consider fundamental?
        Michael Mattias
        Tal Systems Inc. (retired)
        Racine WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          "reading, understanding and applying the Microsoft Windows API
          documentation"
          Reading
          Can't even BEGIN to explain how many times I read, re-read, and re-read again the docs
          Understanding
          Sometimes I could get 3 or even more "Understanding"'s of what the docs say, and when I think I FINALLLLLLlllllllyyyyy get it
          Applying
          Try...if fail, try again and again until no fail....orrrrrrr if just can not find what I missed
          ASK!!!!!!!!!!!


          I don't know about the rest of you guys, but I sure get a lot more of knowledge from a simple working example, than I do from the docs. ESPECIALLY well commented code that does something similar (or even just part of) the idea I am trying to do.

          But hey...thats what PB is for....to illuminate the ole dim bulb and make you go "DOH" so that you finally learn what you totally misunderstood before

          (and yes....as many of you know....I probably have a daily (or close enough) case of CNDS)
          Engineer's Motto: If it aint broke take it apart and fix it

          "If at 1st you don't succeed... call it version 1.0"

          "Half of Programming is coding"....."The other 90% is DEBUGGING"

          "Document my code????" .... "WHYYY??? do you think they call it CODE? "

          Comment


          • #6
            Like any skill (I did refer to it as a "skill" didn't I? Whew! Yes, I did), Cliff, reading, understanding and applying improves with practice.
            Michael Mattias
            Tal Systems Inc. (retired)
            Racine WI USA
            [email protected]
            http://www.talsystems.com

            Comment

            Working...
            X