Announcement

Collapse
No announcement yet.

sysdatetimepick32 calendar or date only, no dropdown.. how to.

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

  • sysdatetimepick32 calendar or date only, no dropdown.. how to.

    I am trying to find a way to have the calendar (sysdatatime32) open and stay open on a dialog of its own. I do not want the drop down date to bring it in, but want to call a dialog with just the calendar and two buttons (Save and clear) to set values in the parent dialog. I have no problem with the drop down, but that is not what I want.
    Barry

  • #2
    You probably mean SysMonthCal32?:
    Code:
    #Compile Exe
    #Include "WIN32API.INC"
    #Include "Commctrl.inc"
    
    Function PBMain
      Local hDlg As Dword, hVal As Dword, icc As INIT_COMMON_CONTROLSEX
      Icc.dwSize = SizeOf(Icc)
      Icc.dwIcc = %ICC_STANDARD_CLASSES Or %ICC_DATE_CLASSES
      InitCommonControlsEx  Icc
      Dialog New 0,"Test",,,200,200,%WS_SYSMENU, To hDlg
      Control Add "SysMonthCal32", hDlg, 300, "", 30, 40,140,100, %WS_CHILD Or %WS_VISIBLE, %WS_EX_CLIENTEDGE
      Dialog Show Modal hDlg
    End Function
    Regards,
    Peter

    "Simplicity is a prerequisite for reliability"

    Comment


    • #3
      And there is a sample program with this control in PBWin's samples, it has been there for several versions:

      F:\PBWin90\Samples\Ddt\Calendar\Calendar.bas

      Might save some time to take a copy of that, modify and then use as an include for your dialog.
      Rick Angell

      Comment


      • #4
        Yea, I found that after I asked. Also, I tried the one I found in PBForms, but it locks up when I call it.
        Barry

        Comment


        • #5
          Hmmm,

          With PB Forms, I just made a dialog with a month calendar and it is ok here.

          What version of PB Forms and ehat OS are you using?
          Last edited by Richard Angell; 22 Sep 2008, 10:13 PM.
          Rick Angell

          Comment


          • #6
            1.52 and xp sp3 Here's the code:

            Code:
            CALLBACK FUNCTION ShowCalendar1Proc()
            
                SELECT CASE AS LONG CBMSG
                    CASE %WM_INITDIALOG
                        ' Initialization handler
                          DIALOG SET LOC CBHNDL, 15,50
                    CASE %WM_NCACTIVATE
                        STATIC hWndSaveFocus AS DWORD
                        IF ISFALSE CBWPARAM THEN
                            ' Save control focus
                            hWndSaveFocus = GetFocus()
                        ELSEIF hWndSaveFocus THEN
                            ' Restore control focus
                            SetFocus(hWndSaveFocus)
                            hWndSaveFocus = 0
                        END IF
            
                    CASE %WM_COMMAND
                        ' Process control notifications
                        SELECT CASE AS LONG CBCTL
                            CASE %IDC_SYSDATETIMEPICK32_7
            
                        END SELECT
                END SELECT
            END FUNCTION
            '------------------------------------------------------------------------------
            
            '------------------------------------------------------------------------------
            FUNCTION ShowCalendar1(BYVAL hParent AS DWORD) AS LONG
                LOCAL lRslt AS LONG
            
            #PBFORMS BEGIN DIALOG %IDD_dlgCalendar1->->
                LOCAL hDlg  AS DWORD
            
                DIALOG NEW hParent, "", 273, 137, 140, 123, %WS_CHILD OR %WS_BORDER OR _
                    %WS_VISIBLE OR %DS_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT, _
                    %WS_EX_STATICEDGE OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
                    %WS_EX_RIGHTSCROLLBAR, TO hDlg
                CONTROL ADD "SysMonthCal32", hDlg, %IDC_SYSMONTHCAL32_1, _
                    "SysMonthCal32_1", 0, 0, 140, 97, %WS_CHILD OR %WS_VISIBLE OR _
                    %WS_TABSTOP, %WS_EX_LEFT OR %WS_EX_LTRREADING OR _
                    %WS_EX_RIGHTSCROLLBAR OR %WS_EX_CLIENTEDGE
                CONTROL ADD BUTTON, hDlg, %Cal_Set1, "Set", 6, 102, 51, 16
                CONTROL ADD BUTTON, hDlg, %btn_Clear1, "Clear", 82, 102, 49, 15
            #PBFORMS END DIALOG
            
                DIALOG SHOW MODAL hDlg, CALL ShowCalendar1Proc TO lRslt
            
            #PBFORMS BEGIN CLEANUP %IDD_dlgCalendar1
            #PBFORMS END CLEANUP
            
                FUNCTION = lRslt
            END FUNCTION
            >>>> Found the problem.. I needed a popup not a child dialog.
            Last edited by Barry Erick; 27 Sep 2008, 09:30 PM.
            Barry

            Comment


            • #7
              Code:
                      CASE [COLOR="Red"]%WM_COMMAND[/COLOR] 
                          SELECT CASE AS LONG CBCTL
                              CASE %IDC_SYSDATETIMEPICK32_7
              All the MCN_xxxx notifications are sent in the form of WM_NOTIFY, not WM_COMMAND.

              MCM_xxxx messages are used to control the control.

              There should be some MonthCal_xxxx macro/functions in COMMCTRL.INC.

              Details in your SDK reference.

              NHL season opens October 4-5 with games in Stockholm and Prague. North American play commences the following Thursday.

              MCM
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment


              • #8
                Hockey.... our first Ex game is this Friday and home on Saturday. First home regular season (AHL) is Wed Oct 8. I watched a AHL practice game on Dish Sunday.
                I know the notify is in WM_Notify, but PBForms put all that code there.
                Barry

                Comment


                • #9
                  > know the notify is in WM_Notify, but PBForms put all that code there.

                  Really.

                  I guess PBFORMS assumes everything sends WM_COMMAND, even "CONTROL ADD classname" controls.

                  I assume it put in WM_COMMAND handler code for the buttons (which do send WM_COMMAND) and you just edited it out for posting purposes.

                  Well, WM_COMMAND for "everything" could certainly be misleading to some people.

                  But let's look on the bright side: at least that code was no additional charge.

                  Milwaukee Admirals have a two (2) game exhibition schedule, a home-and-home with the Chicago Wolves.

                  The home game is at the Kern Center, which is the Milwaukee School of Engineering's ice rink... this Saturday.

                  MCM
                  BSME MSOE '72
                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment


                  • #10
                    Oh GREATTTttttt....the last thing we need is MCM banging the boards

                    Anyone local that can cut the cable??? We need to keep him occupied with something other than Hockey
                    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


                    • #11
                      Originally posted by Michael Mattias View Post
                      > know the notify is in WM_Notify, but PBForms put all that code there.

                      Really.

                      I guess PBFORMS assumes everything sends WM_COMMAND, even "CONTROL ADD classname" controls.

                      I assume it put in WM_COMMAND handler code for the buttons (which do send WM_COMMAND) and you just edited it out for posting purposes.

                      Well, WM_COMMAND for "everything" could certainly be misleading to some people.

                      But let's look on the bright side: at least that code was no additional charge.

                      Milwaukee Admirals have a two (2) game exhibition schedule, a home-and-home with the Chicago Wolves.



                      Late notice: Hi-jacked

                      The home game is at the Kern Center, which is the Milwaukee School of Engineering's ice rink... this Saturday.

                      MCM
                      BSME MSOE '72
                      I probably would have stayed at MSOE if they had hockey when I was there. It only took 30 years to get it here in Wilkes-Barre. I see we don't play Milwaukee or Chicago during the regular season.. probably one of those in the playoffs, again.
                      Last edited by Barry Erick; 24 Sep 2008, 07:42 PM. Reason: Hi-Jacked for a very good reason - GO PENS!
                      Barry

                      Comment


                      • #12
                        Anyone local that can cut the cable??? We need to keep him occupied with something other than Hockey
                        To the box, sir: that cost you 2 minutes for unsportsmanlike conduct.
                        Michael Mattias
                        Tal Systems (retired)
                        Port Washington WI USA
                        [email protected]
                        http://www.talsystems.com

                        Comment


                        • #13
                          Hockey?

                          No, No, that is simply a check into the boards. Unsportsmanlike conduct is using the stick as a club to bash in the back of your head.
                          :) IRC :)

                          Comment


                          • #14
                            " I know the notify is in WM_Notify, but PBForms put all that code there."

                            All what code? ... your example shows a placeholder CASE for any MonthCalendar's WM_COMMAND messages (not WM_NOTIFY notifications). PB Forms does not second guess and add a WM_NOTIFY case for this and many other controls whether you are going to additionally need to intercept this or that message. In some cases there may be no specific WM_COMMAND messages, only WM_NOTIFY notification messages ... and here's the rub ... we need to be aware of that.

                            This is one of those cases where an NFS e-mail to [email protected] would be step 1, IMO.
                            Last edited by Richard Angell; 24 Sep 2008, 07:36 PM. Reason: edited sematics a wee bit
                            Rick Angell

                            Comment


                            • #15
                              In some cases there may be no specific WM_COMMAND messages, only notification messages
                              Um, WM_COMMAND *is* a notification message...... a message sent by the operating system/control in response to a user action.
                              Michael Mattias
                              Tal Systems (retired)
                              Port Washington WI USA
                              [email protected]
                              http://www.talsystems.com

                              Comment


                              • #16
                                Um, the subject is control messages sent as part of a WM_NOTIFY message, but I'll clarify the original post.

                                e.g.
                                This notification message is sent only by month calendar controls that use the MCS_DAYSTATE style, and it is sent in the form of a WM_NOTIFY message
                                Rick Angell

                                Comment


                                • #17

                                  Quote:
                                  Anyone local that can cut the cable??? We need to keep him occupied with something other than Hockey
                                  To the box, sir: that cost you 2 minutes for unsportsmanlike conduct.
                                  Reply With Quote
                                  Not unsportsman like..but more trying to keep a bad hit from becoming a free-for-all

                                  although VERY entertaining

                                  boy do I have a weekend ahead of me...checking out the bruins, and razzing them, when last week I was razzing the sabres about the buins.

                                  what a pain and fun when one can see both sides of the fence *LOL*
                                  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


                                  • #18
                                    Were I a PBFORMS user I would suggest a new feature: "Do not generate any WM_COMMAND code for controls created with "CONTROL ADD Classname"

                                    I don't know what it generates for the 9x compiler's new intrinsic Common Controls such as TREEVIEW, LISTVIEW, etc. Should probably generate WM_NOTIFY handling skeleton using the "new NM.CODE" and "NM.ID" (close to those) system variables.
                                    Michael Mattias
                                    Tal Systems (retired)
                                    Port Washington WI USA
                                    [email protected]
                                    http://www.talsystems.com

                                    Comment


                                    • #19
                                      Re: "notification"

                                      My point has nothing to do with the specific control... it was that WM_COMMAND is but one of any number of 'notification messages' .. messages sent automatically by a control or the operating system (eg WM_SYSINICHANGE).

                                      As contasted with "command messages" ... sent by programmer to make something happen, eg, WM_SETTEXT.
                                      Michael Mattias
                                      Tal Systems (retired)
                                      Port Washington WI USA
                                      [email protected]
                                      http://www.talsystems.com

                                      Comment


                                      • #20
                                        I don't know what it generates for the 9x compiler's new intrinsic Common Controls such as TREEVIEW, LISTVIEW, etc. Should probably generate WM_NOTIFY handling skeleton using the "new NM.CODE" and "NM.ID" (close to those) system variables.
                                        As I have posted on other threads, no. PB Forms has not been updated. So for the present one would want to keep the older, still supported CBxxxxx keywords and CONTROL ADD "classname" statements if they will be doing interactive development. Since %WM_NOTIFY was not typical of PB Forms 1.51 generated code, one can add and develop the %WM_NOTIFY case using the new NM.xxxx keywords. As far as the rest of the new control DDT statements and functions, they too can be used without affecting the ability to use PB Forms interactively with PBWin 9.

                                        Unused %WM_COMMAND control case statements can be removed, in my experience, and not affect interactive use of PB Forms. That said, the issue of adding %WM_COMMAND cases that would not be used has been raised by myself and others before, several ttimes, but adding another "checkmark" doe not hurt either. Expanding PB Forms to allow the addition of more generated code via option checks on the control properties tabs in PB Forms has also been NFS'd
                                        Rick Angell

                                        Comment

                                        Working...
                                        X