TCalendar

TCalendar

Postby David Williams » Sun Sep 16, 2012 3:49 pm

Hi All

When I put a TCalendar control on a window it defaults to one month but when I place it on a dialog it defaults to four months. How can I set it to one month on a dialog. I have only found ::GetVisibleMonths() not ::SetVisibleMonths().

Can anyone help?
David
User avatar
David Williams
 
Posts: 82
Joined: Fri Mar 03, 2006 6:26 pm
Location: Ireland

Re: TCalendar

Postby Eoeo » Sun Sep 16, 2012 3:57 pm

Also I ask this features last week but I not had messages and helps!!!
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: TCalendar

Postby ukoenig » Sun Sep 16, 2012 5:52 pm

There is still another Solution ( doesn't use TCalendar )
Samples : Calendar.prg

Image

I started with a embedded xBrowse-solution :

Image

Best Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: TCalendar

Postby Marcelo Via Giglio » Mon Sep 17, 2012 12:57 am

Hello,

try this

Code: Select all  Expand view

#include "fivewin.ch"

FUNCTION MAIN()
LOCAL oDlg, g, d := DATE()
    DEFINE DIALOG oDlg FROM 10,10 To 20,20
   
    @ 1,1 GET g VAR d ACTION calendar(self)
    g:lKeepFocus := .F.

    ACTIVATE DIALOG oDlg
RETURN NIL

FUNCTION calendar( oGet )
//------------------------------------------------------------------------------
   LOCAL oWnd, oCal, aRect, w, h, x, y, cps
   //LOCAL fecha := IF( isFecha(oGet:cText()), CTOD( oGet:cText() ), DATE() )
   LOCAL fecha := DATE()
   LOCAL dHoy  := fecha, lOk := .F., lLostFocus := .F., n := 0

   IF isAppthemed()
      w := 224; h := 159
   ELSE      
      w := 174; h := 150
   ENDIF
             
   aRect := getWndRect( oGet:hWnd )
   y := aRect[1] + oGet:nHeight
   x := aRect[2]

   DEFINE WINDOW oWnd OF oGet:oWnd FROM y, x TO y + h, x + w PIXEL STYLE nOR( WS_CHILD, WS_POPUP, WS_VISIBLE )

   @ 0, 0 CALENDAR oCal VAR dHoy OF oWnd PIXEL size h,w DBLCLICK ( lOk := .T., oWnd:end() ) //87,75

   oWnd:oClient    := oCal

   oCal:bKeyDown := {|nkey| IF( nKey = 13 .OR. nKey = 32, ( lOk := .T., oWnd:end() ),  ) }
   oWnd:bKeyDown := {|nkey| IF( GetKeyState( VK_ESCAPE ), ( lLostFocus := .T.,  oWnd:end() ), ) }
   oCal:bLostFocus := {|| oWnd:END() }


   ACTIVATE WINDOW oWnd;
           ON INIT ( oWnd:move(aRect[1] + oGet:nHeight ,aRect[2] ),;
                     oCal:setFocus() ) ;
             VALID IF( ! lLostFocus .AND. lOk .AND. ! GetKeyState( VK_ESCAPE ), ;
                      ( oGet:cText := dHoy, oGet:refresh(), oGet:setfocus(), .T. ),;
                      ( oGet:setFocus(), .T. ) )
RETURN NIL


But in order to this sample works, you need to have the last added feature to the GET class, "lKeepFocus" if you don't have the last FWH, you can modify it, following this message http://forums.fivetechsupport.com/viewtopic.php?f=22&t=24697 and if you implement the ON INIT feature, then the code is simplest and clear

Code: Select all  Expand view
FUNCTION MAIN()
LOCAL oDlg, g, d := DATE()
    DEFINE DIALOG oDlg FROM 10,10 To 20,20
   
    @ 1,1 GET g VAR d ACTION calendar(self) ON INIT ::lKeepFocus := .F.

    ACTIVATE DIALOG oDlg
RETURN NIL


http://forums.fivetechsupport.com/viewtopic.php?f=22&t=9676&start=15
Marcelo Via Giglio
 
Posts: 1064
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: TCalendar

Postby ShumingWang » Mon Sep 17, 2012 5:10 am

REDEFINE GET DATE1 ID 102 OF odlg;
ACTION cal( DATE1, self )



FUNCTION cal( date1, oGet )
LOCAL odlg, oCal, aRect
LOCAL lOk := .f.

aRect := getWndRect( oGet:hWnd )

DEFINE DIALOG odlg FROM 0,0 TO 145,265 PIXEL STYLE nor( WS_POPUP,WS_VISIBLE,WS_BORDER)
//150, 174
@-10,-10 CALENDAR oCal VAR date1 OF odlg PIXEL DAYSTATE SIZE 150,89 DBLCLICK (lok:=.t.,odlg:end())
// 155,160
//87,75
oCal:bKeyDown := {|nkey| IF( nKey = 13 .OR. nKey = 32, (lok:=.t.,odlg:end()), ) }
odlg:oClient := oCal

ACTIVATE DIALOG odlg ON INIT (ocal:show(),odlg:move(aRect[1] + oGet:nHeight ,aRect[2])) ;
VALID IF( lOk .AND. ! GetKeyState( VK_ESCAPE ), (oGet:cText := date1, oGet:refresh(), .T. ), .t. )

RETURN NIL
http://www.xtech2.top
Mobile:(86)13802729058
Email:100200651@qq.com
QQ:100200651
Weixin: qq100200651
ShumingWang
 
Posts: 465
Joined: Sun Oct 30, 2005 6:37 am
Location: Guangzhou(Canton),China

Re: TCalendar

Postby Eoeo » Mon Sep 17, 2012 5:13 pm

on win seven crash!!!
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: TCalendar

Postby Uwe.Diemer » Tue Sep 18, 2012 7:13 am

Thanks for this usefull post and the detailed Informations about the Crash

try another username with more than 4 Letters "Eoeo""Fasi" perhaps 5 Letters like "IDI.T"
User avatar
Uwe.Diemer
 
Posts: 98
Joined: Mon Aug 09, 2010 11:00 am

Re: TCalendar

Postby Eoeo » Tue Sep 18, 2012 9:05 am

Uwe.Diemer wrote:Thanks for this usefull post and the detailed Informations about the Crash

try another username with more than 4 Letters "Eoeo""Fasi" perhaps 5 Letters like "IDI.T"



Uwe,
For me this help is important, the test crash on Win Seven then....
I not understood Antonio give YOU the authorization to offend allways my personal freedom!!!
I am on the gap for a long time while there are people as YOU who make smart and have just started to use Fivewin !!!!

eoeo is the name of my website www.eoeo.it
User avatar
Eoeo
 
Posts: 222
Joined: Mon Jun 04, 2012 12:00 pm

Re: TCalendar

Postby David Williams » Tue Sep 18, 2012 10:31 am

Thank you all for your suggestions. I opted for Shuming's code and I have now developed the calendar for my application.

OT. Has anyone developed a Golf Tee Booking System or has there been an update on Daniel García Gil's Outlook Appointments?

Many thanks
David
User avatar
David Williams
 
Posts: 82
Joined: Fri Mar 03, 2006 6:26 pm
Location: Ireland


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 107 guests