Results 1 to 1 of 1

Thread: simple "calendar / datetime" example

  1. #1

    simple "calendar / datetime" example

    this is a little control example for datetime with calendar. it's possible to change the colour of the calendar background or text (font) style? it's always a red border around date and blue background for current date. control set color doesn't work as this control (SysDateTimePick32) hasn't access to canvas module?

    ' Empty GUI script created on 12-19-2011 10:14:10 by largo_winch (ThinAIR)
    '---------> datetime control for UI/canvas : 
    
    Uses "UI"
    
    ' -- ID numbers of controls
    Begin ControlID
      %cCanvasDB 
      %bModifyBitmap
      %bClose 
      %ID_Date
    End ControlID
        
    ' -- Create dialog here
    FUNCTION TBMAIN()
      LOCAL hDlg AS DWORD
    
      Dialog New 0, "simple canvas calendar example",-1,-1, 200, 140, _
                                        %WS_POPUP Or %WS_VISIBLE Or _
                                         %WS_CLIPCHILDREN Or %WS_CAPTION OR _
                                         %WS_SYSMENU Or %WS_MINIMIZEBOX, 0 To hDlg
      Dim cx, cy As Long
      dialog pixels hDlg, 200, 200 to units cx, cy
      Control Add Canvas, hDlg, %cCanvasDB, "", 5, 5, cx, cy    
      Control ADD BUTTON, hDlg, %bClose, "Close", 10+cx, cy+5-14, 50, 14, Call bCloseProc
    
      Control Add "SysDateTimePick32", hDlg, %ID_Date, _
      "SysDateTimePick32", 10, 20, 70, 14, %WS_CHILD Or %WS_VISIBLE Or _
      %WS_TABSTOP Or %DTS_SHORTDATEFORMAT, %WS_EX_CLIENTEDGE Or _
      %WS_EX_LEFT Or %WS_EX_LTRREADING Or %WS_EX_RIGHTSCROLLBAR
    
      'Control Set Color hDlg, %ID_Date, -1, %RED    'always red border with blue background?
      'Control Set Color hDlg, %ID_Date, %GREEN, %YELLOW
    
      Control Set Color hDlg, %ID_Date, Rgb(200,100,0), %YELLOW
      Control Redraw hDlg, %ID_Date
     
      Dialog Show Modal hDlg, Call dlgProc
    
    END FUNCTION
    
    ' -- Callback for dialog
    CALLBACK FUNCTION dlgProc()
    
      ' -- Test for messages
      SELECT CASE CBMSG
        Case %WM_INITDIALOG
          CANVAS_Attach(CBHNDL, %cCanvasDB, %FALSE)
            DrawGraphics()     
          CANVAS_Redraw
         
        CASE %WM_CLOSE
        ' -- Put code to be executed before dialog end here
    
      END SELECT
    
    END FUNCTION
     
    ' -- Callback for close button
    CallBack Function bCloseProc()
    
      If CBMSG = %WM_COMMAND Then       
        If CBCTLMSG = %BN_CLICKED Then
          ' -- Closes the dialog 
          DIALOG END CBHNDL
        END IF
      END IF
    
    End Function
    
          
    SUB DrawGraphics()
        
      Canvas_Color Rgb(128, 255, 0), Rgb(0, 0, 0)
      Canvas_Clear(Rgb(250,250,250))
      Canvas_Scale Pixels
      
    END SUB
    
    bye, largo
    Attached Images Attached Images
    Attached Files Attached Files

Similar Threads

  1. Forum: added "Auto Youtube Link-Converter" plugin
    By ErosOlmi in forum Web and Forum
    Replies: 0
    Last Post: 07-05-2011, 12:47
  2. The original "Python programming in OpenGL" by Stan Blank
    By Petr Schreiber in forum ThinBASIC programming in OpenGL/TBGL
    Replies: 0
    Last Post: 25-02-2010, 17:48
  3. Replies: 17
    Last Post: 21-02-2010, 07:45
  4. Uses "File", "Crypto" ... ???
    By marcuslee in forum thinBasic General
    Replies: 3
    Last Post: 01-12-2009, 19:38

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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