topic stringlengths 1 63 | text stringlengths 1 577k ⌀ |
|---|---|
Calendar / Appointment | Tim,
I have written an event-manager/scheduler class. It´s still in beta state, because the documentation is not completed and it´s not fully tested under W98, W2k and Vista. It´s working fine under XP.
If you want test a demo, please drop me a note. |
Calendar / Appointment | Stefan
I am interested in a demo
Thanks
Richard |
Calendar / Appointment | I can test under XP and Vista. I'd be happy to check it out and provide you with feedback.
I do have a working system, based on the DOS Grumpfish model, but today's windows applications have pretty well standardized on a look and feel.
My email is <!-- e --><a href="mailto:timstone@masterlinksoftware.com">timstone@masterlinksoftware.com</a><!-- e --> and I would appreciate an opportunity to test the class.
Tim |
Calendar / Appointment | I will pleased to test it in windows 98 SE, my email is <!-- e --><a href="mailto:jmurugosa@gmail.com">jmurugosa@gmail.com</a><!-- e --> |
Calendar / Appointment | Hi all,
thanks for your interest, I will compile a demo and send it this afternoon |
Calendar / Appointment | Ok, done !
Richard,
I sent the demo to <!-- e --><a href="mailto:contact@cbati.com">contact@cbati.com</a><!-- e -->, was that right ? |
Calendar / Appointment | Stefan,
i will get it through this email also.
My mail is <!-- e --><a href="mailto:richard@cbati.com">richard@cbati.com</a><!-- e -->
Thanks for your interest
Richard |
Calendar / Appointment | Please include me as well in the demo ..
Rick Lipkin
SC Dept of Health, USA
<!-- e --><a href="mailto:lipkinrm29063@yahoo.com">lipkinrm29063@yahoo.com</a><!-- e --> |
Calendar / Appointment | Stefan,
It may be good idea if you upload it to a public host like rapidshare or similar, in case that you want to share it, before lots of users start requesting it here <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> Thanks, |
Calendar / Appointment | Antonio,
yes, you are right, that a good idea.
Here everyone can download the demo:
[url:2zzclat1]http://rapidshare.com/files/58565980/Event.zip.html[/url:2zzclat1] |
Calendar / Appointment | Stefan
Can you share the source code of the class ?
Tim, Are you using it ?
Thanks for response,
Richard |
Calendar / Appointment | Richard,
No, I'm not using it. I commented back directly on some issues, but in fact, it doesn't work like the calendar/scheduling classes we see today. I'm doing some extensive cleanup work ( about 100,000 lines of code ), and when I finish that ( hopefully next week ), I'm going to look into this issue more extensively, and perhaps build a component that gets me closer to what I want.
I've looked at some existing controls but they don't address DBF files, and they are inherently single user. I want to build a scheduler for a shop that can be accessed from any computer, updated from any computer, and which displays like the current day/week/month schedulers ( ie. Outlook appearance ). I have one right now that is a modification of a DOS scheduler, and it works, but it doesn't have the visual type interface our clients will expect today. Its an enhancement of the old Grumpfish program, turned into a GUI.
Tim |
Calendar / Appointment | Hello
I have almost finish this control .
[url=http://img143.imageshack.us/my.php?image=immaginems7.jpg:3inz2pfl][img:3inz2pfl]http://img143.imageshack.us/img143/6248/immaginems7.th.jpg[/img:3inz2pfl][/url:3inz2pfl]
Regards MAurizio
<!-- w --><a class="postlink" href="http://www.nipeservice.com">www.nipeservice.com</a><!-- w --> |
Calendar / Appointment | Wonderful!
EMG |
Calendar / Appointment | Richard,
[quote="Richard Chidiak":27i6xnta]Stefan
Can you share the source code of the class ?
Richard[/quote:27i6xnta]
No, not at the moment, it´s a project still in progress. At first it was planned to be commercial product, but my actual work in our university as a teacher of CAD takes much time. At the moment I have not much time for programming.
But I will think about it. |
Calendar / Appointment | [quote="Maurizio":1rgnvhhd]Hello
I have almost finish this control .
[url=http://img143.imageshack.us/my.php?image=immaginems7.jpg:1rgnvhhd][img:1rgnvhhd]http://img143.imageshack.us/img143/6248/immaginems7.th.jpg[/img:1rgnvhhd][/url:1rgnvhhd]
Regards MAurizio
<!-- w --><a class="postlink" href="http://www.nipeservice.com">www.nipeservice.com</a><!-- w -->[/quote:1rgnvhhd]NON HO PAROLE !!!!!!Accidenti a me quando ti ho inviato la mia classe !!! |
Calendar Class | Friends:
I need to show a calendar of 12 months where the user can select
the holidays of the year.
Have I seen that there is a control called CALENDAR in PELLESC, has anyone used it?
do you have an example?
I have also seen the class TCalex (I think that it is Daniel García) but I think
that is more oriented to create agendas, or I'm wrong?, and is not exactly what
that I need.
Best regards |
Calendar Class | Perhaps you can use the Otto Pickdate class .. I remember a user could select the days from a year |
Calendar Class | Silvio:
Thanks for your advice, where can I get the Otto's class?
Regards |
Calendar Class | on this forum |
Calendar Class | Silvio:
Yes I have a look to Otto's class but is not exactly what I was looking for. It's see thet is
for agenda.
Thanks & regards |
Calendar Class | you can search Paco Calendar old or Drcal old classes on another sites ( olivares, fivewin.br)
I think they can show 12 month into a dialog to set holydays
Ihad something but not I am far from my home I have men at work in my house because of problems caused by the earthquake |
Calendar Class | Silvio:
Thanks for your advice, and no problems at all, I hope you and your family are ok after
the earthquake.
Regards |
Calendar Control | About a month ago several people were noting the need for a Calendar control in their applications. Although DTPICKER provides a good popup for a date field, the idea was to post a calendar onto a dialog that would remain on display.
Actually, in the \FWH\Samples there is a calendar.prg & .rc that can be modified quite nicely to do the job. Using FW Harbour's bitmap controls and expanding the size of the dialog can result in a useable date selection control that can coexist with other data very nicely.
I have a Scheduler program that incoporates a lot of data in addition to just the date. It is used for automotive repair so it attaches to a vehicle, client, and estimate. It incorporates a beginning and end time and a work area. This is all handled well with normal FWH ( 7.12 ) and xHarbour.
The original Calendar was written by Tom Waldon for 16 bit Clipper. I'd be happy to share the samples of my very simply modified controls with Antonio because they are derived from the distributed work of FWH, or if he wishes, I can post a link for their download.
[b:2rgf2et4]This is not a stand alone control ! [/b:2rgf2et4] It is simply FWH code that can be included in your own project if you have a need. It is used within a resource (.rc) file and can be included as part of an existing dialog, or as the base to create a dialog.
If appropriate, I'm sure this snippet could be upgraded quite nicely. |
Calendar Control | Tim
I found that code myself and I took the basic calendar and modified it to our Agency's Time and Reporting system.
I use the buttons to build an array ( by date ) for users to enter in their codes associated with their job activities.
Interesting to look at as well to see how to hide controls based on the different days in a month.
Kewl code !!
Rick Lipkin |
Calendar Control | Why don't you try the calendar, you find at my website ?
Greetings from Germany
U. König <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
Calendar Control | Its nice and functional, but I wanted just a simple calendar to put on an existing dialog. What I was able to do with the FWH sample code, and modifying it, works well. |
Calendar Control | I like the C5 Calendar control
Take a look |
Calendar Control | I'm sure there are many excellent calendar controls. As I pointed out, this is not a control. It is simply a modification of the program that is included with FWH when supplied by Antonio, and it shows you how to build a calendar on to an existing Dialog. I posted the info simply because people had asked about it in the past. |
Calendar Control | [quote="ukoenig":18ltb684]Why don't you try the calendar, you find at my website ?[/quote:18ltb684]
Ukoenig,
I had dowloaded your calendar. Congratulation.
In its source code I read spanish comments and function's names with spanish contents. Which is the origin of this calendar class?
Regards |
Calendar Control | A few years ago, i found a calendar-class for the
16 Bit FW, but it was in spanish.
I had to do some changes, to use it for the new FWH.
For me it was not easy, because i don't know anything about spanish.
Greetings from germany
U.König <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: --> |
Calendar Control | I think...
Mr Tim Stone are searching another type of calendar ....like office 2007
But he want it free .... |
Calendar Control | No, I don't want something for free. I needed an immediate, interim, solution for a specific project.
In the long term, I will be implementing several controls, and none of them do I expect to be free .... |
Calendar Control | Wich is the specific project ?
Can you explain me please ? |
Calendar Control | I sent you a screen shot by email of the completed work ... for now
I also explained the various elements.
It is an appointment scheduler for vehicle services. It includes the following:
+ Scheduling an appointment for any day and/or time and varied intervals
+ Attaching a vehicle, and client to the appointment
+ Creating and Attaching an estimate, which includes parts and labor ( in detail ) to the appointment
+ Attaching notes to the appointment
+ Assigning the appointment to a specific work area
+ Permitting reoccuring appointments ( auto scheduling )
+ The ability to move appointments
+ Printing of the schedule
+ A Gant chart for day, and one for the week, which shows work areas and the times assigned
+ The ability to select a date on a calendar and instantly see all the appointments for that day, and the detail
+ Additional notes capability
This scheduler interfaces with the workorder development screen. By starting a workorder, pressing the Appointment button, you see a list of pending appointments. Select the one you want, and it automatically adds the client, vehicle, parts, labor, and notes to the newly created workorder ... on button select !
It all works perfectly. I had a defined space in which to create the date selection capability. It was working fine with DTPicker but I wanted to show all of the calendar ( for the month ) for single key press changes of the viewed date. WIth DTPICKER it takes two keystrokes, and my clients don't like even one extra keystrokes.
I had to get this done so I could ship software to my clients. This is only one very small part of the application ... perhaps 1% of the total project.
I may soon purchase a control that gives me more flexibility. For example, C5 ( mentioned previously by a contributor ) will supposedly allow me to change the display of all dates on the calendar where an appointment may be scheduled. Its not necessary, but it is nice. The Codejock controls are very powerful, but they are clearly an Outlook display and I'm not yet sure if that will work properly in this situation.
Anyway, my need was resolved last week with a modification of the existing FWH code, and when I move forward to enhance the look of this I would certainly find it wise to use one of the commercial calendar controls available at the time. However, it is also important to handle all of the various data components.
BTW ... programming is to meet the needs of my clients. I could easily do this in a more window methodology with a popup appointment screen, but they want to see all the data as they scroll through the appointments, and the list of all the appointments when they select the date.
I hope this isn't too wordy. |
Calendar Control | ok I understand |
Calendar Control | Tim,
Your thorough description of how you use your modification of the FWH calendar.prg lit up a few lights for me in my application area (HR performance management). Thanks for getting me thinking! Could you provide a link for downloading your mod of calendar.prg and calendar.rc?
Thanks.
- Roger |
Calendar Control | Email me: timstone at masterlinksoftware dot com |
Calendar Control Date Format | In the tcalenda.prg class, you define the date format to British by default. All of my date lookups are American, but once the calendar is run once, it changes the display throughout the program.
Is there a call to override your default ? If not, there needs to be. I revised it in the source code, but we wouldn't want to do this with every future release. Thanks. |
Calendar Control Date Format | Tim...
the calendar is a control from window api, this depend of date format from windows, you can use SET DATE TO AMERICAN
[img:308a39qd]http://www.sitasoft.net/fivewin/screen/dateformat.png[/img:308a39qd]
using SET DATE TO AMERICAN
[img:308a39qd]http://www.sitasoft.net/fivewin/screen/dateamerican.png[/img:308a39qd]
the class not use British format by default, the class use #define DATEFORMAT "dd/mm/yyyy" only for control, for this way the class "know" where is DAY, MONTH and YEAR (always), i mean if you use SET DATE TO AMERICAN, internally the class change to "dd/mm/yyyy" in some methods but after restore to America format again, METHOD SaveDateFormat() and METHOD RestoreDateFormat() |
Calendar Pro | Now that several people are working with CodeJock, has anyone actually tried working with the Calendar Pro module ? Its a powerful tool if it can be used with FWH 9.04. |
Calendar Pro | Hi Tim,
This is a First simple screen shot.
[img:xrt4a3cv]http://www.fivetech.com.tw/fwh/ribbonbar_calendar01.jpg[/img:xrt4a3cv]
[img:xrt4a3cv]http://www.fivetech.com.tw/fwh/ribbonbar_calendar02.jpg[/img:xrt4a3cv]
Please visit my Ribbonbar sample code and add these lines.
[code=fw:xrt4a3cv]<div class="fw" id="{CB}" style="font-family: monospace;"><br /><span style="color: #00C800;">local</span> oAct2<br /><br /> oAct2 := TActiveX<span style="color: #000000;">(</span><span style="color: #000000;">)</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">(</span> oWnd, <span style="color: #ff0000;">"Codejock.CalendarControl.12.1.1"</span>, <span style="color: #000000;">150</span>, <span style="color: #000000;">0</span>, <span style="color: #000000;">1000</span>, <span style="color: #000000;">550</span> <span style="color: #000000;">)</span><br /> </div>[/code:xrt4a3cv]
Richard |
Calendar integrated with Google Calendar | Good afternoon!
Recently developed a schedule linked to google calendar.
It is working using the Google OAuth 2.0 authentication method, which is the new form of authentication token google.
Some images:
Permission:
[img:v7sw7rdk]http://imagizer.imageshack.us/v2/640x480q90/922/IjvZTb.jpg[/img:v7sw7rdk]
Home Screen
[img:v7sw7rdk]http://imagizer.imageshack.us/v2/640x480q90/921/81RT2K.jpg[/img:v7sw7rdk]
Details
[img:v7sw7rdk]http://imagizer.imageshack.us/v2/640x480q90/921/dswGwA.jpg[/img:v7sw7rdk]
Full application has control with local database.
To MYSQL is ready, but is easily adapdata to any other type of database (DBF, Postgres, etc).
I'm selling the application code, to be able to include the schedule in its application
OAuth 2.0 authentication method can be used for any other integration with google.
To work DEMO MODE:
* You must create a project on google apis: [url:v7sw7rdk]https://console.developers.google.com/apis/[/url:v7sw7rdk]
* Enable Google Calendar API
* Create credentials of the "Customer ID OAuth 2.0", Under Application type, choose "Other".
* Perform download the JSON file and rename it to "client_id.json".
** To facilitate the execution of DEMO MODE, I set my file "CLIENT_ID.JSON" to download. But it is for a limited period.
Download JSON File: [url:v7sw7rdk]https://bitbucket.org/wmanesco/schedule/downloads/client_id.json[/url:v7sw7rdk]
Put together with the application.
I will put demo mode for download
To buy the code send email to <!-- e --><a href="mailto:manesco.william@gmail.com">manesco.william@gmail.com</a><!-- e -->
Any problems of implementation or questions, report on the forum or email
Thank you!
download: [url:v7sw7rdk]https://bitbucket.org/wmanesco/schedule/downloads/Schedule.rar[/url:v7sw7rdk]
Download JSON File: [url:v7sw7rdk]https://bitbucket.org/wmanesco/schedule/downloads/client_id.json[/url:v7sw7rdk] Place Together with the application. |
Calendar integrated with Google Calendar | William his work is fantastic, congratulations ...
I really want to buy, I will send an email to know the details of payment!
<!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
Calendar integrated with Google Calendar | Very thanks for the response and interest in the product!
<!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
Calendar integrated with Google Calendar | To facilitate the execution of DEMO MODE, I set my file "CLIENT_ID.JSON" to download. But it is for a limited period.
[url:258kv6oi]https://bitbucket.org/wmanesco/schedule/downloads/client_id.json[/url:258kv6oi] |
Calendar integrated with Google Calendar | <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D -->
I am very happy with this implementation, my clients are praising much. Congratulations on the job! |
Calendar integrated with Google Calendar | Thanks!!
<!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> |
Calendar integrated with Google Calendar | Good job, good code and interesting functionality to integrate into systems! |
Calendar integrated with Google Calendar | Thank you for opinion, it is very important! <!-- s8) --><img src="{SMILIES_PATH}/icon_cool.gif" alt="8)" title="Cool" /><!-- s8) --> |
Calendar integrated with Google Calendar | Compliments, excellent work.
Thanks.
Maurizio |
Calendar integrated with Google Calendar | Thanks Maurizio!
I'm happy with review. |
Calendar integrated with Google Calendar | Good job! Thanks for sending the code! My customers look forward for having it into my app. Thanks a lot also for the very good contact and fast answers of my emails. |
Calendar integrated with Google Calendar | Very thanks!! |
Calendar integrated with Google Calendar | Just to inform.
There is a new version with some fixes and improvements! |
Calendar integrated with Google Calendar | But why not use tcalex class and integrated with it the export to Google calendar ? |
Calendar integrated with Google Calendar | I believe it can be done well, but I honestly didn't to work with TCalex and would like to have more control over the application. The main one (google integration) can be adapted to use as needed...
Thanks |
Calendario anual | Alguien sabe si existe algún control de calendario anual del tipo los doce meses en el mismo control, no me refiero a los 12 cuadritos de los meses, si no a 12 lineas una por cada mes, recuerdo haberlo visto en los antiguos programas del grupo sp, y antiguamente alguien hizo algo cuando teníamos el foro de las news.Alguien me puede poner en la pista.Gracias. |
Calendario anual | [quote="Andrés González":2fkr8m78]Alguien sabe si existe algún control de calendario anual del tipo los doce meses en el mismo control, no me refiero a los 12 cuadritos de los meses, si no a 12 lineas una por cada mes, recuerdo haberlo visto en los antiguos programas del grupo sp, y antiguamente alguien hizo algo cuando teníamos el foro de las news.
Alguien me puede poner en la pista.[/quote:2fkr8m78]Hola Andrés:[img:2fkr8m78]http://img515.imageshack.us/img515/6633/calanualxa1.jpg[/img:2fkr8m78]Es algo así lo que necesitas?Saludos.Manuel Mercado. |
Calendario anual | Manuel... qeu control es ese??? Es free? Lo necesito..<!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> |
Calendario anual | [quote="Ricardo Ramirez E.":1cx439k2]Manuel... qeu control es ese???Es free?
Lo necesito..<!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->[/quote:1cx439k2]jajajaNo sé que pasó con la imagen, aquí la pongo nuevamente:[img:1cx439k2]http://img294.imageshack.us/img294/9752/calanualrn6.jpg[/img:1cx439k2]Simplemente con la idea de Andrés ayer mismo (no me tomó más de 2 horas) escribí este programa cuya función principal recibe una fecha, muestra el calendario de todo el año con TSBrowse y devuelve la nueva fecha seleccionada.Si a alguien le sirve, con gusto se lo envío.Saludos.Manuel Mercado |
Calendario anual | D. Manuel, sí sí sí sí sí sí sí eso es exactamente lo que quiero, pero quiero añadirle datos en las casillas osea al dia [1 M] [2 M] [3 M.]... [6 L] [7 L], que como veo no debe de haber ningún problema. Vamos, la idea es plasmar un cuadrante de servicios de una plantilla, tengo ya cosas hechas con un calendario mensual, donde en cada casilla pongo el servicio de cada día de una persona, pero también estaba mirando la posibilidad de que se saliera por todo un año y recordé que hacia mucho tiempo los del grupo sp lo habían hecho, por eso pensé que el control ya debía de estar hecho. Es usted un genio. No es una pregunta es una afirmación. Espero ávido noticias suyas. Por cierto debe de usted estar en América pues empieza la semana en domingo y aquí la empezamos el lunes.Un cordial saludo. |
Calendario anual | He cambiado la dirección de email pues google nos da mas capacidad para enviara fichero si usted lo desea. |
Calendario anual | D. Manuel he compilado perfectamente sin problema alguno, bueno solo cuando hago dobleclick en la cabecera de los días de la semana me hace otro orden distinto de los días y si pulso en la primera o ultima semana me genera un error pero el mes me lo muestra tal cual lo ha puesto usted en el foro. Por otra parte sigo investigando como cambiar el día de inicio para que sea un lunes no un domingo y como hacer mas grande las celdas para poner mas datos en ellas. Le comento cosas a medida que se me ocurran. |
Calendario anual | [quote="Andrés González":32jkzvhv]cuando hago dobleclick en la cabecera de los días de la semana me hace otro orden distinto de los días y si pulso en la primera o ultima semana me genera un error[/quote:32jkzvhv]En la sección With Object oBrw en CalAnual.prg, agrega esta línea:[code:32jkzvhv] :lNoChangeOrd := .T.
[/code:32jkzvhv]Saludos.Manuel Mercado |
Calendario anual | D. Manuel, he modificado la anchura de las filas y he intentado cambiar el día de inicio pero no lo consigo quiero que la semana empiece en lunes, me puede aconsejar. Ademas quiero también poner una altura diferente y supongo que debe de haber un comando para ello pero de momento no lo he conseguido.A modo de ejemplo pero de forma lineal lo que pretendo hacer es poner en cada casilla del mes el servicio de cada uno vea la foto siguiente. Supongo que se puede poner otra font mas pequeña para los números de mes y asi dejar espacio para poner dos dígitos que identifican el servicio de cada uno[url=http://img387.imageshack.us/my.php?image=screenshotxv6.jpg:3uvhcooe][img:3uvhcooe]http://img387.imageshack.us/img387/3439/screenshotxv6.th.jpg[/img:3uvhcooe][/url:3uvhcooe]Un Saludo |
Calendario anual | Gracias incluida y ya no cambia el orden al pulsar la cabecera. No logro cambiar el día de inicio a lunes, algún consejo. |
Calendario anual | Estimado Manuel.[quote="mmercado":1ko65vyv]
Si a alguien le sirve, con gusto se lo envío.
[/quote:1ko65vyv]Puedes enviarme el ejemplo al correo : nazariosn @ yahoo . com . mxGracias y saludos. |
Calendario anual | Manuel <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->Puedes enviarmela a mi tambien <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) --> ?ricardocva @ yahoo. esSaludos...Ricardo Ramírez! |
Calendario anual | Esperaremos a que conteste el Sr. Mercado, en caso contrario si no le parece mal os lo enviaré yo. Os garantizo que funciona fenomenal con añadirlo a los ejemplos del tsbrowse me ha funcionado sin problemas, ya lo tengo añadido y funcionando en mi programa. |
Calendario anual | Simplemente con la idea de Andrés ayer mismo (no me tomó más de 2 horas) escribí este programa cuya función principal recibe una fecha, muestra el calendario de todo el año con TSBrowse y devuelve la nueva fecha seleccionada.Si a alguien le sirve, con gusto se lo envío.Saludos.Manuel Mercado[/quote]Manuel, ¿puede enviármela? GraciasSaludos<!-- e --><a href="mailto:falegria230349@yahoo.es">falegria230349@yahoo.es</a><!-- e --> |
Calendario anual | [quote="Ricardo Ramirez E.":3r0sai0b]Puedes enviarmela a mi tambien[/quote:3r0sai0b]Una Disculpa por la tardanza.Mejor se los pongo aquí, no es muy grande.[code:3r0sai0b]#include "Fivewin.ch"
#include "TSBrowse.ch"
//--------------------------------------------------------------------------------------------------------------------//
Function CalAnual( dDate )
Local oDlg, oBrw, nCol, dFecha, nMonth, aLine, bBlock, nDia, nMes, nYear, ;
aCale := {}, ;
aMes := { "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic" }, ;
aSem := { "Mes", "Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab", ;
"Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab", ;
"Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab", ;
"Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab", ;
"Dom", "Lun", "Mar", "Mie", "Jue", "Vie", "Sab", "Dom", "Lun", "Mar", "Mie" }
Default dDate := Date()
SET DATE BRITISH
SET EPOCH TO Year( Date() ) - 70
SetKey( VK_UP, {|| If( GetKeyState( VK_CONTROL ), aSetCale( StoD( Str( --nYear, 4 ) + StrZero( nMes, 2 ) + ;
StrZero( nDia, 2 ) ), oBrw, oDlg ), Nil ) } )
SetKey( VK_DOWN, {|| If( GetKeyState( VK_CONTROL ), aSetCale( StoD( Str( ++nYear, 4 ) + StrZero( nMes, 2 ) + ;
StrZero( nDia, 2 ) ), oBrw, oDlg ), Nil ) } )
nYear := Year( dDate )
aCale := aSetCale( dDate )
nDia := AScan( aCale[ Month( dDate ) ], {|e,n| n > 1 .and. e == Day( dDate ) } )
DEFINE DIALOG oDlg TITLE Str( nYear ) SIZE 760, 210
@ 0, 0 BROWSE oBrw ARRAY aCale OF oDlg SIZE 385, 107 PIXEL CELLED ;
COLORS CLR_BLACK, {|r,c| If( c == 1, CLR_HGRAY, CLR_WHITE ) }, ;
{ |c| If( c== oBrw:nCell, CLR_WHITE, CLR_BLACK ) }, ;
{ |c| If( c== oBrw:nCell, CLR_BLACK, CLR_HGRAY ) }, CLR_WHITE, CLR_BLACK
For nCol := 1 To 38
bBlock := bDetachable( oBrw, nCol )
ADD COLUMN TO oBrw DATA bBlock TITLE aSem[ Min( 42, nCol ) ] SIZE 20 ALIGN DT_RIGHT
oBrw:aColumns[ nCol ]:bGotFocus := {|| Eval( oBrw:bChange ) }
Next
With Object oBrw
:lNoChangeOrd := .T.
:lNoHSCroll := .T.
:lInitGoTop := .F.
:aColumns[ 1 ]:lFixLite := .T.
:nFreeze := 1
:lLockFreeze := .T.
:nRowPos := Month( dDate )
:bChange := { || If( Empty( oBrw:aArray[ oBrw:nAt, oBrw:nCell ] ), dFecha := CtoD( "//" ), ( ;
dFecha := Ctod( StrZero( nDia := oBrw:aArray[ oBrw:nAt, oBrw:nCell ], 2 ) + "/" + ;
StrZero( nMes := oBrw:nAt, 2 ) + "/" + Str( nYear ) ), oBrw:DrawHeaders() ) ) }
End With
ACTIVATE DIALOG oDlg CENTER ON INIT oBrw:HiliteCell( nDia )
Return dFecha
//--------------------------------------------------------------------------------------------------------------------//
Static Function bDetachable( oBrw, nCol )
Return { |uVar| If( uVar == Nil, oBrw:aArray[ oBrw:nAt, nCol ], oBrw:aArray[ oBrw:nAt, nCol ] := uVar ) }
//--------------------------------------------------------------------------------------------------------------------//
Static Function aSetCale( dDate, oBrw, oDlg )
Local aLine, nMonth, nCol, dFecha, nYear, nDia, ;
aMes := { "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic" }, ;
aArr := {}
nYear := Year( dDate )
For nMonth := 1 To 12
dFecha := CtoD( "01/" + StrZero( nMonth, 2 ) + "/" + Str( nYear ) )
nCol := DoW( dFecha )
aLine := Array( 39 )
While Month( dFecha ) == nMonth
aLine[ nCol++ ] := Day( dFecha )
dFecha ++
EndDo
AAdd( aArr, aLine )
Next
For nCol := 1 To Len( aArr )
ASize( aArr[ nCol ], 40 )
AIns( aArr[ nCol ], 1 )
aArr[ nCol, 1 ] := aMes[ nCol ]
Next
If oBrw != Nil
nDia := AScan( aArr[ Month( dDate ) ], {|e,n| n > 1 .and. e == Day( dDate ) } )
oBrw:SetArray( aArr )
oBrw:nRowPos := Month( dDate )
oBrw:HiliteCell( nDia )
oDlg:SetText( Str( nYear, 4 ) )
EndIf
Return aArr
//--------------------------------------------------------------------------------------------------------------------//
Static Function StoD( cAnsiDate )
Local cFormat := Upper( Set( _SET_DATEFORMAT ) ), ;
cYear := SubStr( cAnsiDate, 1, 4 ), ;
cMon := SubStr( cAnsiDate, 5, 2 ), ;
cDay := SubStr( cAnsiDate, 7, 2 )
cFormat := StrTran( cFormat, "YYYY", cYear )
cFormat := StrTran( cFormat, "YY", Right( cYear, 2 ) )
cFormat := StrTran( cFormat, "MM", cMon )
cFormat := StrTran( cFormat, "DD", cDay )
Return CtoD( cFormat )
[/code:3r0sai0b]Saludos.Manuel Mercado |
Calendario anual | Gracias <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->Saludos |
Calendario anual | Manuel.Gracias.Saludos |
Calendario anual | Regards,OttoON CLICK - MOUSEMOVE - ButtonUp[img:1nhr3jw4]http://www.atzwanger.com/fw/pickdate2.jpg[/img:1nhr3jw4][code:1nhr3jw4]#include "fivewin.ch"
STATIC oWndPlan
STATIC planFont
STATIC sX := 1
STATIC sY := 1
STATIC sXTemp := 0
STATIC sYTemp := 0
STATIC aPlan := {}
STATIC startRow :=0
STATIC startCol :=0
STATIC startDay :=""
STATIC oBrush
STATIC lMove :=.f.
STATIC hBru
STATIC hPen
STATIC hPen1
STATIC hPen3
STATIC aTemp := {}
STATIC nStartZeile := 0
function main()
aadd(aTemp,{0,0}) // 1
aadd(aTemp,{0,0}) // 2
aadd(aTemp,{0,0}) // 3
aadd(aTemp,{0,0}) // 4
aadd(aTemp,{0,0}) // 5
aadd(aTemp,{0,0}) // 6
aadd(aTemp,{0,0}) // 7
aadd(aTemp,{0,0}) // 8
aadd(aTemp,{0,0}) // 9
aadd(aTemp,{0,0}) // 10
aadd(aTemp,{0,0}) // 11
aadd(aTemp,{0,0}) // 12
SET DATE GERMAN
***
hBru := CreateSolidBrush( RGB(217,230,246) )
hPen := CreatePen( 0, 1, 12632256 )
hPen1 := CreatePen( 0, 1, 280 )
hPen3 := CreatePen( 0, 18,RGB(183,249,185) )//Sonntagsspalte
DEFINE BRUSH oBrush COLOR RGB(255,255,255)
DEFINE FONT planFont NAME "ARIAL" SIZE 0,-11
***
DEFINE WINDOW oWndPlan TITLE "Kalender" ;
HSCROLL ;
FROM 5, 5 TO 24, 98
oWndPlan:bLClicked := { |y,x,flags | f_bLClicked(y,x) }
oWndPlan:bMMoved := { |y,x,flags | f_MMoved(y,x) }
oWndPlan:bLButtonUp := { |y,x,flags | f_LButtonUp(y,x) }
ACTIVATE WINDOW oWndPlan ON PAINT DrawRowLines()
return nil
func DrawRowLines ()
LOCAL I, nCurrentRows, iZeile
LOCAL cHeader1 := ""
LOCAL oSay
LOCAL hdc
LOCAL aDays := {;
"So","Mo","Di", "Mi", "Do", "Fr", "Sa","So",;
"Mo","Di", "Mi", "Do", "Fr", "Sa","So",;
"Mo","Di", "Mi", "Do", "Fr", "Sa","So",;
"Mo","Di", "Mi", "Do", "Fr", "Sa","So",;
"Mo","Di", "Mi", "Do", "Fr", "Sa","So","Mo" }
LOCAL nYear := YEAR( DATE() )
LOCAL cYear := STR( nYear, 4 )
LOCAL dDate, nStart
LOCAL lSchaltJahr := ( DAY( CTOD( "29.02." + cYear ) ) <> 0 )
LOCAL aDaysInMonth := { 31, IIF( lSchaltJahr, 29, 28 ), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
LOCAL nColOffSet := 10
LOCAL aRect1
LOCAL IMonate := 0
LOCAL ITemp := 0
local cTest := ""
local nEnde
FOR IMonate := 1 TO 12
aadd(aPlan,{"","","", "", "", "", "","",;
"","", "", "", "", "","",;
"","", "", "", "", "","",;
"","", "", "", "", "","",;
"","", "", "", "", "","","",0,0,0 } )
NEXT
aRect1 := { 0,0,500,1000}
FillRect(oWndPlan:hDc,aRect1,oBrush:hBrush)
iZeile := 0
nCurrentRows := 30
FOR I := 1 TO 13
SelectObject( oWndPlan:hDc, hPen )
IF iZeile = 5
SelectObject( oWndPlan:hDc, hPen1 )
iZeile := 0
ENDIF
//Lines
oWndPlan:line (nCurrentRows, 1,nCurrentRows, 726 )
nCurrentRows := nCurrentRows + 18
iZeile := iZeile + 1
NEXT
nCurrentRows:= 50
FOR I := 1 TO 38
SelectObject( oWndPlan:hDc, hPen )
IF iZeile = 5
SelectObject( oWndPlan:hDc, hPen1 )
iZeile := 0
ENDIF
oWndPlan:line (10,nColOffSet + nCurrentRows,400, nColOffSet + nCurrentRows )
nCurrentRows := nCurrentRows + 18
iZeile := iZeile + 1
NEXT
nCurrentRows:= 50
FOR I := 1 TO len(aDays)
if aDays[I] = "So"
//Farbhintergrund Sonntag
SelectObject( oWndPlan:hDc, hPen3 )
// Sonntag erste fette Linie
oWndPlan:line (0,nColOffSet+ 10 + nCurrentRows,400, nColOffSet+ 10 + nCurrentRows )
SelectObject( oWndPlan:hDc, hPen )
oWndPlan:say( 8, nColOffSet+36+I*18,aDays[I],RGB(255,128,0), RGB(125,236,175),planFont,.T.)
else
oWndPlan:say( 8, nColOffSet+36+I*18,aDays[I],RGB(255,128,0),16777215,planFont,.T.)
endif
nCurrentRows := nCurrentRows + 18
NEXT
nCurrentRows := 12
FOR I := 1 TO 12
SelectObject( oWndPlan:hDc, hPen )
IF iZeile = 5
SelectObject( oWndPlan:hDc, hPen1 )
iZeile := 0
ENDIF
nCurrentRows := nCurrentRows + 18
dDate := CTOD( "01." + PADL( ALLTRIM(STR( i, 2 )), 2, "0" ) + "." + cYear )
nStart := DOW( dDate )
aPlan[I,38] := nStart
aPlan[I,39] := 30-18+ (18*( aDaysInMonth[i] + nStart - 1 )) //col begin of month
aPlan[I,40] := nStart + aDaysInMonth[i] //col end of month
FOR iZeile := nStart TO aDaysInMonth[i] + nStart - 1
aPlan[I,iZeile] = ( PADL( ALLTRIM(STR( (iZeile-nStart+1), 2 )), 2, "0" )+ "." + PADL( ALLTRIM(STR( (I), 2 )), 2, "0" ) + "." + cYear )
NEXT
cHeader1 := OemToAnsi( CMONTH( dDate ) ) //Monate
oWndPlan:say( nCurrentRows+1, 2, cHeader1,RGB(63,63,63),16777215,planFont,.T.)
NEXT
IF (sy > 0 .AND. sy < 13) .AND. (sx > 0 .AND. sx < 38)
IF lMove = .t.
IZeile := INT((syTemp-30)/18 ) + 1
aTemp[IZeile,1]:=10
FOR ITemp := IZeile+1 TO 12
aTemp[ITemp,1]:=0
NEXT
FOR ITemp := 1 TO 12
if aTemp[ITemp,1] > 0
if sXTemp > aPlan[ITemp,39] + aPlan[ITemp,38]*18
sXTemp := aPlan[ITemp,39] + aPlan[ITemp,38]*18
endif
IF 30-18+ (18*(ITemp)) >= startCol .AND. ;
.NOT. (30-18+ (18*(ITemp)) = startCol .AND. ;
startRow > sXTemp)
FillRect( oWndPlan:hDc, { 30-18+ (18*(ITemp)),startRow, 30 +(18*(ITemp)), sXTemp}, hBru )
IF ITemp > nStartZeile
FillRect( oWndPlan:hDc, { 30-18+ (18*(ITemp-1)),startRow, 30 +(18*(ITemp-1)), (30 +( 13 + 18*(aPlan[ITemp-1,40]))) }, hBru )
FillRect( oWndPlan:hDc, { 30-18+ (18*(ITemp)), 30 + 13 + (18*(aPlan[ITemp,38])), 30 +(18*(ITemp)), sXTemp}, hBru )
ENDIF
else
FillRect( oWndPlan:hDc, {startCol,startRow,startCol+18,startRow+18}, hBru )
ENDIF
endif
NEXT
ENDIF
ENDIF
nCurrentRows := 12
FOR I := 1 TO 12
SelectObject( oWndPlan:hDc, hPen )
IF iZeile = 5
SelectObject( oWndPlan:hDc, hPen1 )
iZeile := 0
ENDIF
nCurrentRows := nCurrentRows + 18
dDate := CTOD( "01." + PADL( ALLTRIM(STR( i, 2 )), 2, "0" ) + "." + cYear )
nStart := DOW( dDate )
aPlan[I,38] := nStart
aPlan[I,39] := 30-18+ (18*( aDaysInMonth[i] + nStart - 1 )) //col begin of month
aPlan[I,40] := nStart + aDaysInMonth[i] //col end of month
FOR iZeile := nStart TO aDaysInMonth[i] + nStart - 1
cHeader1 := ALLTRIM(str(iZeile-nStart+1)) //Tage
if aDays[iZeile] = "So"
oWndPlan:say( nCurrentRows+3,36 + nColOffSet + (iZeile) *18, ;
cHeader1, RGB(63,63,63),RGB(125,236,175),planFont,.T.,.T.)
else
oWndPlan:say( nCurrentRows+3,36 + nColOffSet + (iZeile) *18, ;
cHeader1, RGB(63,63,63),16777215,planFont,.T., .T.)
ENDIF
NEXT
NEXT
IF (sy > 0 .AND. sy < 13) .AND. (sx > 0 .AND. sx < 38)
oWndPlan:say(syTemp+20, sxTemp-20, aPlan[sy, sx] + " # "+str(ctod(aPlan[sy, sx])-ctod(startDay)+ 1), RGB(63,63,63), RGB(125,236,175), planFont, .T. )
endif
return nil
func f_LButtonUp(y,x)
msginfo(startDay + " -- " + aPlan[sy, sx] + " Tage: " + str( ctod(aPlan[sy, sx])-ctod(startDay) +1 ))
lMove:=.f.
return nil
func f_MMoved(y,x)
IF sy <> (INT((y-30)/18 ) + 1) .OR. sy <> (INT( (x-50-10)/18 ) + 1 )
sy := INT((y-30)/18 ) + 1
sx := INT((x-50-10)/18 ) + 1
IF y < 30
sy := 0
y := 0
ENDIF
syTemp := y
sxTemp := 59 + sx * 18
oWndPlan:refresh()
ENDIF
return nil
func f_bLClicked(y,x)
local ITemp:=0
sy := INT((y-30)/18 ) + 1
sx := INT((x-50-10)/18 ) + 1
startDay := aPlan[sy, sx]
nStartZeile := sy
startRow := INT((x - 30)/18)*18 + 18 + 7
startCol := (INT((y-30)/18 ))*18 + 30
FOR ITemp := 1 TO 12
aTemp[ITemp,1]:=0
NEXT
FillRect( oWndPlan:hDc, {startCol,startRow,startCol+18,startRow+18}, hBru )
oWndPlan:refresh()
lMove:=.t.
return nil
[/code:1nhr3jw4] |
Calendario anual | Hi Otto:Very nice work, congratulations.Manuel Mercado |
Calendario anual | Thanks Otto, great work, very nice and clean.Congratulations. |
Calendario anual | I saw that I had a mistake in naming the variables. X was y and vice versa. I changed the code. Please lets go ahead with this. Carles: What is local aInfo := oWndPlan:DispBegin() exactly doing? Regards, Otto PS: Could you please send me your email addresses. I would like to share my snipkeeper code with you, too. datron&aon.at (& =@) Code: #include "fivewin.ch" STATIC oWndPlan STATIC planFont STATIC sy := 1 STATIC sx := 1 STATIC syTemp := 0 STATIC sxTemp := 0 STATIC aPlan := {} STATIC ClickCol :=0 STATIC ClickRow :=0 STATIC startDay :="" STATIC oBrush STATIC lMove :=.f. STATIC hBru STATIC hPen STATIC hPen1 STATIC hPen3 STATIC aTemp := {} STATIC nStartZeile := 0 /* ********** added by rochinha, modify by Quique ********** */ STATIC nYear /* ********** added by rochinha, modify by Quique ********** */ function main() /* ********** added by rochinha, modify by Quique ********** */ nYear := YEAR( DATE() ) /* ********** added by rochinha, modify by Quique ********** */ aadd(aTemp,{0,0}) // 1 aadd(aTemp,{0,0}) // 2 aadd(aTemp,{0,0}) // 3 aadd(aTemp,{0,0}) // 4 aadd(aTemp,{0,0}) // 5 aadd(aTemp,{0,0}) // 6 aadd(aTemp,{0,0}) // 7 aadd(aTemp,{0,0}) // 8 aadd(aTemp,{0,0}) // 9 aadd(aTemp,{0,0}) // 10 aadd(aTemp,{0,0}) // 11 aadd(aTemp,{0,0}) // 12 SET DATE GERMAN *** hBru := CreateSolidBrush( RGB(217,230,246) ) hPen := CreatePen( 0, 1, 12632256 ) hPen1 := CreatePen( 0, 1, 280 ) hPen3 := CreatePen( 0, 18,RGB(183,249,185) )//Sonntagsspalte DEFINE BRUSH oBrush COLOR RGB(255,255,255) DEFINE FONT planFont NAME "ARIAL" SIZE 0,-11 *** DEFINE WINDOW oWndPlan TITLE "Kalender" ; HSCROLL ; FROM 5, 5 TO 24, 98 oWndPlan:bLClicked := { |x,y,flags | f_bLClicked(x,y) } oWndPlan:bMMoved := { |x,y,flags | f_MMoved(x,y) } oWndPlan:bLButtonUp := { |x,y,flags | f_LButtonUp(x,y) } /* ********** added by rochinha ********** */ oWndPlan:cTitle := "Kalender [ " + str(nYear,4) + " ]" /* ********** added by rochinha ********** */ /* ********** added by rochinha ********** */ oWndPlan:oHScroll:bGoUp := {|| PreviousYear() } oWndPlan:oHScroll:bGoDown := {|| NextYear() } /* ********** added by rochinha ********** */ ACTIVATE WINDOW oWndPlan ON PAINT DrawRowLines() return nil func PreviousYear() /* ********** added by rochinha ********** */ nYear := nYear - 1 DrawRowLines() oWndPlan:refresh() oWndPlan:cTitle := "Kalender [ " + str(nYear,4) + " ]" return .t. func NextYear() /* ********** added by rochinha ********** */ nYear := nYear + 1 DrawRowLines() oWndPlan:refresh() oWndPlan:cTitle := "Kalender [ " + str(nYear,4) + " ]" return .t. func DrawRowLines () //Charleslocal aInfo := oWndPlan:DispBegin() //Charles LOCAL I, nCurrentRows, iZeile LOCAL cHeader1 := "" LOCAL oSay LOCAL hdc LOCAL aDays := {; "So","Mo","Di", "Mi", "Do", "Fr", "Sa","So",; "Mo","Di", "Mi", "Do", "Fr", "Sa","So",; "Mo","Di", "Mi", "Do", "Fr", "Sa","So",; "Mo","Di", "Mi", "Do", "Fr", "Sa","So",; "Mo","Di", "Mi", "Do", "Fr", "Sa","So","Mo" } /* blocked by rochinha LOCAL nYear := YEAR( DATE() ) */ LOCAL cYear := STR( nYear, 4 ) LOCAL dDate, nStart LOCAL lSchaltJahr := ( DAY( CTOD( "29.02." + cYear ) ) <> 0 ) LOCAL aDaysInMonth := { 31, IIF( lSchaltJahr, 29, 28 ), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } LOCAL nColOffSet := 10 LOCAL aRect1 LOCAL IMonate := 0 LOCAL ITemp := 0 local cTest := "" local nEnde FOR IMonate := 1 TO 12 aadd(aPlan,{"","","", "", "", "", "","",; "","", "", "", "", "","",; "","", "", "", "", "","",; "","", "", "", "", "","",; "","", "", "", "", "","","",0,0,0 } ) NEXT aRect1 := { 0,0,500,1000} FillRect(oWndPlan:hDc,aRect1,oBrush:hBrush) iZeile := 0 nCurrentRows := 30 FOR I := 1 TO 13 SelectObject( oWndPlan:hDc, hPen ) IF iZeile = 5 SelectObject( oWndPlan:hDc, hPen1 ) iZeile := 0 ENDIF //Lines oWndPlan:line (nCurrentRows, 1,nCurrentRows, 726 ) nCurrentRows := nCurrentRows + 18 iZeile := iZeile + 1 NEXT nCurrentRows:= 50 FOR I := 1 TO 38 SelectObject( oWndPlan:hDc, hPen ) IF iZeile = 5 SelectObject( oWndPlan:hDc, hPen1 ) iZeile := 0 ENDIF oWndPlan:line (10,nColOffSet + nCurrentRows,400, nColOffSet + nCurrentRows ) nCurrentRows := nCurrentRows + 18 iZeile := iZeile + 1 NEXT nCurrentRows:= 50 FOR I := 1 TO len(aDays) if aDays[I] = "So" //Farbhintergrund Sonntag SelectObject( oWndPlan:hDc, hPen3 ) // Sonntag erste fette Linie oWndPlan:line (0,nColOffSet+ 10 + nCurrentRows,400, nColOffSet+ 10 + nCurrentRows ) SelectObject( oWndPlan:hDc, hPen ) oWndPlan:say( 8, nColOffSet+36+I*18,aDays[I],RGB(255,128,0), RGB(125,236,175),planFont,.T.) else oWndPlan:say( 8, nColOffSet+36+I*18,aDays[I],RGB(255,128,0),16777215,planFont,.T.) endif nCurrentRows := nCurrentRows + 18 NEXT nCurrentRows := 12 FOR I := 1 TO 12 SelectObject( oWndPlan:hDc, hPen ) IF iZeile = 5 SelectObject( oWndPlan:hDc, hPen1 ) iZeile := 0 ENDIF nCurrentRows := nCurrentRows + 18 dDate := CTOD( "01." + PADL( ALLTRIM(STR( i, 2 )), 2, "0" ) + "." + cYear ) nStart := DOW( dDate ) aPlan[I,38] := nStart aPlan[I,39] := 30-18+ (18*( aDaysInMonth[i] + nStart - 1 )) //col begin of month aPlan[I,40] := nStart + aDaysInMonth[i] //col end of month FOR iZeile := nStart TO aDaysInMonth[i] + nStart - 1 aPlan[I,iZeile] = ( PADL( ALLTRIM(STR( (iZeile-nStart+1), 2 )), 2, "0" )+ "." + PADL( ALLTRIM(STR( (I), 2 )), 2, "0" ) + "." + cYear ) NEXT cHeader1 := OemToAnsi( CMONTH( dDate ) ) //Monate oWndPlan:say( nCurrentRows+1, 2, cHeader1,RGB(63,63,63),16777215,planFont,.T.) NEXT IF (sx > 0 .AND. sx < 13) .AND. (sy > 0 .AND. sy < 38) IF lMove = .t. IZeile := INT((sxTemp-30)/18 ) + 1 aTemp[IZeile,1]:=10 FOR ITemp := IZeile+1 TO 12 aTemp[ITemp,1]:=0 NEXT FOR ITemp := 1 TO 12 if aTemp[ITemp,1] > 0 if syTemp > aPlan[ITemp,39] + aPlan[ITemp,38]*18 syTemp := aPlan[ITemp,39] + aPlan[ITemp,38]*18 endif IF 30-18+ (18*(ITemp)) >= ClickRow .AND. ; .NOT. (30-18+ (18*(ITemp)) = ClickRow .AND. ; ClickCol > syTemp) FillRect( oWndPlan:hDc, { 30-18+ (18*(ITemp)),ClickCol, 30 +(18*(ITemp)), syTemp}, hBru ) IF ITemp > nStartZeile FillRect( oWndPlan:hDc, { 30-18+ (18*(ITemp-1)),ClickCol, 30 +(18*(ITemp-1)), (30 +( 13 + 18*(aPlan[ITemp-1,40]))) }, hBru ) FillRect( oWndPlan:hDc, { 30-18+ (18*(ITemp)), 30 + 13 + (18*(aPlan[ITemp,38])), 30 +(18*(ITemp)), syTemp}, hBru ) ENDIF else FillRect( oWndPlan:hDc, {ClickRow,ClickCol,ClickRow+18,ClickCol+18}, hBru ) ENDIF endif NEXT ENDIF ENDIF nCurrentRows := 12 FOR I := 1 TO 12 SelectObject( oWndPlan:hDc, hPen ) IF iZeile = 5 SelectObject( oWndPlan:hDc, hPen1 ) iZeile := 0 ENDIF nCurrentRows := nCurrentRows + 18 dDate := CTOD( "01." + PADL( ALLTRIM(STR( i, 2 )), 2, "0" ) + "." + cYear ) nStart := DOW( dDate ) aPlan[I,38] := nStart aPlan[I,39] := 30-18+ (18*( aDaysInMonth[i] + nStart - 1 )) //col begin of month aPlan[I,40] := nStart + aDaysInMonth[i] //col end of month FOR iZeile := nStart TO aDaysInMonth[i] + nStart - 1 cHeader1 := ALLTRIM(str(iZeile-nStart+1)) //Tage if aDays[iZeile] = "So" oWndPlan:say( nCurrentRows+3,36 + nColOffSet + (iZeile) *18, ; cHeader1, RGB(63,63,63),RGB(125,236,175),planFont,.T.,.T.) else oWndPlan:say( nCurrentRows+3,36 + nColOffSet + (iZeile) *18, ; cHeader1, RGB(63,63,63),16777215,planFont,.T., .T.) ENDIF NEXT NEXT IF (sx > 0 .AND. sx < 13) .AND. (sy > 0 .AND. sy < 38) oWndPlan:say(sxTemp+20, syTemp-20, aPlan[sx, sy] + " # "+str(ctod(aPlan[sx, sy])-ctod(startDay)+ 1), RGB(63,63,63), RGB(125,236,175), planFont, .T. ) endif oWndPlan:DispEnd( aInfo ) return nil func f_LButtonUp(x,y) IF sy > 0 // Quique msginfo(startDay + " -- " + aPlan[sx, sy] + " Tage: " + str( ctod(aPlan[sx, sy])-ctod(startDay) +1 )) ENDIF lMove:=.f. return nil func f_MMoved(x,y) IF sx <> (INT((x-30)/18 ) + 1) .OR. sx <> (INT( (y-50-10)/18 ) + 1 ) sx := INT((x-30)/18 ) + 1 sy := INT((y-50-10)/18 ) + 1 IF x < 30 sx := 0 x := 0 ENDIF sxTemp := x syTemp := 59 + sy * 18 oWndPlan:refresh() ENDIF return nil func f_bLClicked(x,y) local ITemp:=0 sx := INT((x-30)/18 ) + 1 sy := INT((y-50-10)/18 ) + 1 IF sy > 0 // Quique startDay := aPlan[sx, sy] nStartZeile := sx ClickCol := INT((y - 30)/18)*18 + 18 + 7 ClickRow := (INT((x-30)/18 ))*18 + 30 FOR ITemp := 1 TO 12 aTemp[ITemp,1]:=0 NEXT FillRect( oWndPlan:hDc, {ClickRow,ClickCol,ClickRow+18,ClickCol+18}, hBru ) oWndPlan:refresh() lMove:=.t. ENDIF return nil |
Calendario anual | Otto something wrong put the code in inside of code labels... some funny faces are inside.I arranged the code, but in both examples when you try to mark de days the last days are not marked. Try to mark from 1/1/08 to 31/12/08 the last days will be not marked. But the result ist correct they say the days correctly and the nember of the days also correctly. The wrong days are 29,30,31 / 12/ year.... if you try other month work perfectly.. |
Calendario anual | [code:1jzltno8]// This sample shows how to create pickdate.
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
LOCAL oPickDate
oPickDate := TPickdate():New()
oPickDate:nWidth := 14
oPickDate:nHeight := 30
msginfo(oPickDate:GetDate())
oPickDate:end()
return nil
********************************************************************************
*** CLASS Tpickdate
********************************************************************************
//----------------------------------------------------------------------------//
#include "FiveWin.ch"
//-----------------------------------------------------------------//
CLASS Tpickdate
DATA VERSION
DATA nYear
DATA nWidth,nHeight,nStartCols,nStartRow
DATA oWnd,planFont,sy,sx
DATA ClickRow,syTemp,sxTemp,ClickCol
DATA aPlan,nStartZeile
DATA startDay,endDay,oBrush,lMove
DATA hBru,hPen,hPen1,hPen3,aTemp
METHOD New()
method PreviousYear()
method NextYear()
method GetDate()
method LButtonUp(x,y)
method bLClicked(x,y)
method DrawRowLines ()
method MMoved(x,y)
METHOD End()
ENDCLASS
//-----------------------------------------------------------------//
METHOD New() CLASS Tpickdate
::VERSION := "1.0.0"
::nWidth := 10
::nHeight := 10
::nStartCols := 50
::nStartRow := 30
::nYear := YEAR( DATE() )
::hBru := CreateSolidBrush( RGB(217,230,246) )
::hPen := CreatePen( 0, 1, 12632256 )
::hPen1 := CreatePen( 0, 1, 280 )
::hPen3 := CreatePen( 0, ::nWidth,RGB(183,249,185) ) //Sonntagsspalte
DEFINE BRUSH ::oBrush COLOR RGB(255,255,255)
DEFINE FONT ::planFont NAME "ARIAL" SIZE 0,-11
::sy := 1
::sx := 1
::syTemp := 0
::sxTemp := 0
::aPlan := {}
::ClickCol := 0
::ClickRow := 0
::startDay := ""
::endDay := ""
::lMove := .f.
::aTemp := {}
::nStartZeile := 0
aadd(::aTemp,{0,0}) // 1
aadd(::aTemp,{0,0}) // 2
aadd(::aTemp,{0,0}) // 3
aadd(::aTemp,{0,0}) // 4
aadd(::aTemp,{0,0}) // 5
aadd(::aTemp,{0,0}) // 6
aadd(::aTemp,{0,0}) // 7
aadd(::aTemp,{0,0}) // 8
aadd(::aTemp,{0,0}) // 9
aadd(::aTemp,{0,0}) // 10
aadd(::aTemp,{0,0}) // 11
aadd(::aTemp,{0,0}) // 12
SET DATE GERMAN
return Self
//----------------------------------------------------------------------------//
method GetDate()
local cZeitraum := ""
local oSelf:= Self
::hPen3 := CreatePen( 0, ::nWidth,RGB(183,249,185) ) //Sonntagsspalte
DEFINE WINDOW ::oWnd TITLE "Kalender" ;
VSCROLL ;
FROM 5, 5 TO 24, 98
::oWnd:bLClicked := { |x,y,flags | ::bLClicked(x,y) }
::oWnd:bMMoved := { |x,y,flags | ::MMoved(x,y) }
::oWnd:bLButtonUp := { |x,y,flags | ::LButtonUp(x,y) }
::oWnd:cTitle := "Kalender [ " + str(::nYear,4) + " ]"
::oWnd:oVScroll:bGoUp := {|| ::PreviousYear() }
::oWnd:oVScroll:bGoDown := {|| ::NextYear() }
ACTIVATE WINDOW ::oWnd ON INIT (oSelf:oWnd:nWidth( oSelf:nStartCols + 38 * oSelf:nWidth + oSelf:nWidth + oSelf:nWidth),;
oSelf:oWnd:nHeight(oSelf:nStartRow + 13 * oSelf:nHeight ) );
ON PAINT ::DrawRowLines() VALID ((cZeitraum := ::startDay + " -- " + ::endDay + " Tage: " + str( ctod(::endDay)-ctod(::startDay) +1 )),.t.)
return (cZeitraum)
//-----------------------------------------------------------------//
method PreviousYear()
::nYear := ::nYear - 1
::DrawRowLines()
::oWnd:refresh()
::oWnd:cTitle := "Kalender [ " + str(::nYear,4) + " ]"
return .t.
//-----------------------------------------------------------------//
method NextYear()
::nYear := ::nYear + 1
::DrawRowLines()
::oWnd:refresh()
::oWnd:cTitle := "Kalender [ " + str(::nYear,4) + " ]"
return .t.
//-----------------------------------------------------------------//
method LButtonUp(x,y)
::endDay := ::aPlan[::sx,::sy]
IF ::sy > 0 .AND. ::sx > 0
if msgYesNo(::startDay + " -- " + ::endDay + " Tage: " + str( ctod(::endDay)-ctod(::startDay) +1 ))=.t.
::oWnd:end()
endif
ENDIF
::lMove:=.f.
return nil
//-----------------------------------------------------------------//
method bLClicked(x,y)
local ITemp := 0
::sx := INT((x - ::nStartRow)/::nHeight ) + 1
::sy := INT((y - ::nStartCols)/::nWidth )
IF ::sy > 0 .AND. ::sx > 0
::startDay := ::aPlan[::sx,::sy]
::nStartZeile := ::sx
::ClickRow := (INT((x-::nStartRow)/::nHeight ))*::nHeight + ::nStartRow
::ClickCol := ::nStartCols + ::sy * ::nWidth
FOR ITemp := 1 TO 12
::aTemp[ITemp,1]:=0
NEXT
::oWnd:refresh()
::lMove:=.t.
ENDIF
return nil
//-----------------------------------------------------------------//
method DrawRowLines ()
local aInfo := ::oWnd:DispBegin()
local I, nCurrentRows, iZeile
local nCurrentCol
local cHeader1 := ""
local oSay
local hdc
local aDays := {;
"So","Mo","Di", "Mi", "Do", "Fr", "Sa","So",;
"Mo","Di", "Mi", "Do", "Fr", "Sa","So",;
"Mo","Di", "Mi", "Do", "Fr", "Sa","So",;
"Mo","Di", "Mi", "Do", "Fr", "Sa","So",;
"Mo","Di", "Mi", "Do", "Fr", "Sa","So","Mo" }
local cYear := STR( ::nYear, 4 )
local dDate, nStart
local lSchaltJahr := ( DAY( CTOD( "29.02." + cYear ) ) <> 0 )
local aDaysInMonth := { 31, IIF( lSchaltJahr, 29, 28 ), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local aRect1
local IMonate := 0
local ITemp := 0
local cTest := ""
local nEnde
local iSpalte := 0
local nRight
local nBottom
local nLeft
local nTop
FOR IMonate := 1 TO 12
aadd(::aPlan,{"","","", "", "", "", "","",;
"","", "", "", "", "","",;
"","", "", "", "", "","",;
"","", "", "", "", "","",;
"","", "", "", "", "","","",0,0,0 } )
NEXT
aRect1 := { 0,0, ::nStartRow + (13 * ::nHeight) ,::nStartCols + (38 * ::nWidth) + ::nWidth} //procl
FillRect(::oWnd:hDc,aRect1,::oBrush:hBrush)
iZeile := 0
nCurrentCol := ::nStartCols
FOR I := 1 TO 38
SelectObject( ::oWnd:hDc, ::hPen )
IF iZeile = 5
SelectObject( ::oWnd:hDc, ::hPen1 )
iZeile := 0
ENDIF
//vertikale Linie zw. Tage
::oWnd:line (10, ::nWidth + nCurrentCol, ::nStartRow + (13 * ::nHeight), ::nWidth + nCurrentCol )
nCurrentCol := nCurrentCol + ::nWidth
iZeile := iZeile + 1
NEXT
nCurrentCol := ::nStartCols
FOR I := 1 TO len(aDays)
if aDays[I] = "So"
//Farbhintergrund Sonntag
SelectObject( ::oWnd:hDc, ::hPen3 )
// Sonntag erste fette Linie
::oWnd:line (0, ::nWidth + ::nWidth/2 + nCurrentCol,::nStartRow + (13 * ::nHeight), ::nWidth + ::nWidth/2 + nCurrentCol )
SelectObject( ::oWnd:hDc, ::hPen )
::oWnd:say( 8, ::nWidth+36+I* ::nWidth,aDays[I],RGB(255,128,0), RGB(125,236,175),::planFont,.T.)
else
::oWnd:say( 8, ::nWidth+36+I*::nWidth,aDays[I],RGB(255,128,0),16777215,::planFont,.T.)
endif
nCurrentCol := nCurrentCol + ::nWidth
NEXT
nCurrentRows := ::nStartRow
FOR I := 1 TO 13
SelectObject( ::oWnd:hDc, ::hPen )
IF iZeile = 5
SelectObject( ::oWnd:hDc, ::hPen1 )
iZeile := 0
ENDIF
//Lines
::oWnd:line (nCurrentRows, 1,nCurrentRows, ::nStartCols+ 38 * ::nWidth ) //726
nCurrentRows := nCurrentRows + ::nHeight
iZeile := iZeile + 1
NEXT
nCurrentRows := 12
FOR I := 1 TO 12
SelectObject( ::oWnd:hDc, ::hPen )
IF iZeile = 5
SelectObject( ::oWnd:hDc, ::hPen1 )
iZeile := 0
ENDIF
nCurrentRows := nCurrentRows + ::nHeight
dDate := CTOD( "01." + PADL( ALLTRIM(STR( i, 2 )), 2, "0" ) + "." + cYear )
nStart := DOW( dDate )
::aPlan[I,38] := nStart
::aPlan[I,39] := ::nStartCols + ::nWidth * nStart //- ::nWidth //col begin of month
::aPlan[I,40] := nStart + aDaysInMonth[i] //col end of month
FOR iSpalte := nStart TO aDaysInMonth[i] + nStart - 1
::aPlan[I,iSpalte] = ( PADL( ALLTRIM(STR( (iSpalte-nStart+1), 2 )), 2, "0" )+ "." + PADL( ALLTRIM(STR( (I), 2 )), 2, "0" ) + "." + cYear )
NEXT
cHeader1 := OemToAnsi( CMONTH( dDate ) )//Monate
::oWnd:say( nCurrentRows+1, 2, cHeader1,RGB(63,63,63),16777215,::planFont,.T.)
NEXT
IF (::sx > 0 .AND. ::sx < 13) .AND. (::sy > 0 .AND. ::sy < 38)
IF ::lMove = .t.
IZeile := ::sx
::aTemp[IZeile,1] := 10
FOR ITemp := IZeile+1 TO 12
::aTemp[ITemp,1] := 0
NEXT
FOR ITemp := 1 TO 12
if ::aTemp[ITemp,1] > 0
IF ctod(::aPlan[::sx,::sy]) > ctod(" . . ")
FillRect( ::oWnd:hDc, {::ClickRow,;
::ClickCol,;
::ClickRow+::nHeight,;
::ClickCol+::nWidth}, ::hBru )
IF ::nStartRow-::nHeight + (::nHeight*(ITemp)) = ::ClickRow .OR. IZeile=1
nTop := ::nStartRow - ::nHeight + (::nHeight*(ITemp))
nLeft := ::ClickCol
IF ::ClickCol < ::aPlan[ITemp,39]
nLeft := ::aPlan[ITemp,39]
ENDIF
nBottom := ::nStartRow + (::nHeight*(ITemp))
nRight := ::syTemp
IF ::syTemp > nLeft
IF ::syTemp <= ::nStartCols+::aPlan[ITemp,40]*::nWidth
FillRect( ::oWnd:hDc, {nTop,;
nLeft,;
nBottom,;
nRight },::hBru)
ENDIF
ENDIF
ELSEIF ITemp > ::nStartZeile
**********
IF ITemp > ::nStartZeile+1
nTop := ::nStartRow - ::nHeight + (::nHeight*(ITemp-1))
nLeft := ::aPlan[ITemp-1,39]
nBottom := ::nStartRow + (::nHeight*(ITemp-1))
nRight := ::nStartCols +( ::nWidth*(::aPlan[ITemp-1,40]))
IF ::syTemp >= ::aPlan[ITemp,39]
IF ::syTemp <= ::nStartCols+::aPlan[ITemp,40]*::nWidth
FillRect( ::oWnd:hDc, {nTop,;
nLeft,;
nBottom,;
nRight },::hBru)
ENDIF
ENDIF
ENDIF
***********
nTop := ::nStartRow - ::nHeight + (::nHeight*(ITemp))
nLeft := ::aPlan[ITemp,39]
nBottom := ::nStartRow + (::nHeight*(ITemp))
nRight := ::syTemp
IF ::syTemp >= ::aPlan[ITemp,39]
IF ::syTemp <= ::nStartCols+::aPlan[ITemp,40]*::nWidth
FillRect( ::oWnd:hDc, {nTop,;
nLeft,;
nBottom,;
nRight },::hBru)
ENDIF
ENDIF
nTop := ::nStartRow-::nHeight+ (::nHeight*(ITemp-1))
nLeft := ::ClickCol
IF ::ClickCol < ::aPlan[ITemp-1,39]
nLeft := ::aPlan[ITemp-1,39]
ENDIF
nBottom := ::nStartRow +(::nHeight*(ITemp-1))
nRight := ::nStartCols +( ::nWidth*(::aPlan[ITemp-1,40]))
FillRect( ::oWnd:hDc, {nTop,;
nLeft,;
nBottom,;
nRight }, ::hBru )
else
ENDIF
ENDIF
endif
NEXT
ENDIF
ENDIF
nCurrentRows := 12
FOR I := 1 TO 12
SelectObject( ::oWnd:hDc, ::hPen )
IF iZeile = 5
SelectObject( ::oWnd:hDc, ::hPen1 )
iZeile := 0
ENDIF
nCurrentRows := nCurrentRows + ::nHeight
dDate := CTOD( "01." + PADL( ALLTRIM(STR( i, 2 )), 2, "0" ) + "." + cYear )
nStart := DOW( dDate )
FOR iZeile := nStart TO aDaysInMonth[i] + nStart - 1
cHeader1 := ALLTRIM(str(iZeile-nStart+1)) //Tage
if aDays[iZeile] = "So"
::oWnd:say( nCurrentRows+3,36 + ::nWidth + (iZeile) * ::nWidth, cHeader1, RGB(63,63,63),RGB(125,236,175),::planFont,.T.,.T.)
else
::oWnd:say( nCurrentRows+3,36 + ::nWidth + (iZeile) * ::nWidth, cHeader1, RGB(63,63,63),16777215,::planFont,.T., .T.)
ENDIF
NEXT
NEXT
IF (::sx > 0 .AND. ::sx < 13) .AND. (::sy > 0 .AND. ::sy < 38)
::oWnd:say(::sxTemp+20, ::syTemp-20, ::aPlan[::sx,::sy] + " # "+str(ctod(::aPlan[::sx,::sy])-ctod(::startDay)+ 1), RGB(63,63,63), RGB(125,236,175), ::planFont, .T. )
endif
::oWnd:DispEnd( aInfo )
return nil
//-----------------------------------------------------------------//
method MMoved(x,y)
IF ::sx <> (INT((x-::nStartRow)/::nHeight ) + 1) .OR. ::sx <> (INT( (y-::nStartCols )/::nHeight ) + 1 )
::sx := INT((x-::nStartRow)/::nHeight ) + 1
::sy := INT((y -::nStartCols )/::nWidth )
IF x < ::nStartRow
::sx := 0
x := 0
ENDIF
::sxTemp := ::nStartRow + ::sx * ::nHeight
::syTemp := ::nStartCols + ::sy * ::nWidth + ::nWidth
::oWnd:refresh()
ENDIF
return nil
//-----------------------------------------------------------------//
METHOD End()
RELEASE FONT ::planFont
::hBru:end()
::hPen:end()
::hPen1:end()
::hPen3:end()
return NIL
//-----------------------------------------------------------------//[/code:1jzltno8] |
Calendario anual | Hay que seguir en el foro ingles:<!-- m --><a class="postlink" href="http://forums.fivetechsoft.com/viewtopic.php?t=12021">http://forums.fivetechsoft.com/viewtopic.php?t=12021</a><!-- m -->[/url] |
Calendario anual | Gracias Otto, ¿puedes ponerlo dentro de un bloque de código para no perder el formato del programa y simbolos que se pierden por los emoticons?Andy, creo que está bien que esté aquí también, porque no todos hablamos ingles. |
Calendario anual | Tienes razon Quique perdona pero como lo encontre en el foro ingles no reparé en poner el mensaje. |
Calendario anual | Thanks Otto for transforming into a Class.Gracias Otto por transformala en una Classe. |
Calendario anual | <!-- m --><a class="postlink" href="http://forums.fivetechsoft.com/viewtopic.php?t=12150">http://forums.fivetechsoft.com/viewtopic.php?t=12150</a><!-- m -->I have new sourcecode on the English forum.Regrads,Otto |
Calendario anual | To all,Antonio published the full sourcecode of the new pickdate control and a demo sample on the English forum.Antonio, thank you very much for your help.Regards,Otto[img:1nmn1116]http://www.atzwanger.com/fw/pickdateclass.jpg[/img:1nmn1116] |
Calendario anual | Gracias Otto, Antonio, Manuel. Ya la tengo en uso:[url=http://img368.imageshack.us/my.php?image=asistenciamu5.jpg:1lgvfz7m][img:1lgvfz7m]http://img368.imageshack.us/img368/5341/asistenciamu5.th.jpg[/img:1lgvfz7m][/url:1lgvfz7m] |
Calendario anual | Alfredo,How YOu can set each day ?can we see the source or the method modified ? |
Calendario anual | Enviado a tu buzón. |
Calendario anual | Alfredo,Se agradece si publicas los cambios aqui para que sirvan para todos, gracias <!-- s:-) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":-)" title="Smile" /><!-- s:-) --> |
Calendario anual | Con gusto Antonio, aquí lo tienes:No hay secretos, solo pequeños cambios para identificar los días especiales a resaltar, estos los he pasado como arreglos de fechas en formato DtoS().- Se ajustó el control en unos pixeles abajo, derecha y encabezados.- Se cambió GradientFill() por Gradient() -no me he actualizado-.- Se agregó LightColor() para suavizar colores.Aprovecho el viaje.Alguna vez se publicó el código para determinar las fechas que corresponden a la Semana Santa, me pregunto si alguien lo conserva y puede compartirlo? [code:1m6o7zpe]
#Include "FiveWin.ch"
MemVar nClrM // Color principal usado en toda la aplicación
// por definición GetSysColor(2)
CLASS TPickDate FROM TControl
DATA dStart, dEnd, dTemp, lMove
DATA nYear
DATA oBrushSunday, oBrushSelected, oFontHeader
DATA nLeftStart, nTopStart
DATA bSelect
DATA aFIng, aFBaj, aDVac, aDFal, aDInc, aDFes, aDSan, aDNLb // días especiales
CLASSDATA lRegistered AS LOGICAL
METHOD New( nTop, nLeft, nWidth, nHeight, oWnd, nYear, nClrFore, nClrBack )
METHOD Redefine( nId, oWnd )
METHOD Paint()
METHOD Display() INLINE ::BeginPaint(), ::Paint(), ::EndPaint(), 0
METHOD Destroy()
METHOD LButtonDown( nRow, nCol, nKeyFlags )
METHOD LButtonUp( nRow, nCol, nKeyFlags )
METHOD PreviousYear() INLINE ::nYear--, ::Refresh()
METHOD NextYear() INLINE ::nYear++, ::Refresh()
METHOD EraseBkGnd( hDC ) INLINE 0
METHOD MouseMove( nRow, nCol, nKeyFlags )
ENDCLASS
//----------------------------------------------------------------------------//
METHOD New( nTop, nLeft, nWidth, nHeight, oWnd, nYear, nClrFore, nClrBack ) CLASS TPickDate
DEFAULT nWidth := 800,;
nHeight := 300,;
nLeft := 0,;
nTop := 0,;
nYear := Year( Date() ), ;
oWnd := GetWndDefault(),;
nClrm := GetSysColor( 2 )
::lMove = .F.
::nTopStart = 0 // for header
::nLeftStart = 75 // col header
::nTop = nTop
::nLeft = nLeft
::nBottom = nTop + nHeight - 1
::nRight = nLeft + nWidth - 1
::nYear = Year( Date() )
::oWnd = oWnd
::aFIng = {} // arreglos de días especiales
::aFBaj = {}
::aDVac = {}
::aDFal = {}
::aDInc = {}
::aDFes = {}
::aDSan = {}
::aDNLb = {}
::dStart := ::dEnd := ::dTemp := Date()
::nClrText = nClrFore
::nClrPane = nClrBack
::nStyle = nOr( WS_CHILD, WS_VISIBLE, WS_TABSTOP, WS_BORDER )
DEFINE BRUSH ::oBrushSunday COLOR LightColor(240,nClrM) // Sundays column green brush
DEFINE BRUSH ::oBrushSelected COLOR nRGB( 240, 232, 188 ) // Selected days orange brush
DEFINE FONT ::oFont NAME "MS Sans Serif" SIZE 0, -10 BOLD
DEFINE FONT ::oFontHeader NAME "MS Sans Serif" SIZE 0, -10
#ifdef __XPP__
DEFAULT ::lRegistered := .F.
#endif
::Register()
if ! Empty( oWnd:hWnd )
::Create()
oWnd:AddControl( Self )
else
oWnd:DefControl( Self )
endif
return self
//----------------------------------------------------------------------------//
METHOD Redefine( nId, oWnd ) CLASS TPickDate
DEFAULT oWnd := GetWndDefault(), ;
nClrm:= GetSysColor( 2 )
::nId = nId
::oWnd = oWnd
::lMove = .F.
::nTopStart = 0 // for header
::nLeftStart = 75 // col header
::dStart := ::dEnd := ::dTemp := Date()
::nYear = Year( Date() )
::aFIng = {} // arreglos de días especiales
::aFBaj = {}
::aDVac = {}
::aDFal = {}
::aDInc = {}
::aDFes = {}
::aDSan = {}
::aDNLb = {}
DEFINE BRUSH ::oBrushSunday COLOR LightColor(240,nClrM) // nRGB( 183, 249, 185 ) // Sundays column green brush
DEFINE BRUSH ::oBrushSelected COLOR nRGB( 240, 232, 188 ) // Selected days orange brush
DEFINE FONT ::oFont NAME "MS Sans Serif" SIZE 0, -10 BOLD
DEFINE FONT ::oFontHeader NAME "MS Sans Serif" SIZE 0, -10
::SetColor( 0, 0 )
::Register()
oWnd:DefControl( Self )
return Self
//----------------------------------------------------------------------------//
METHOD Paint() CLASS TPickDate
local aInfo := ::DispBegin()
local hDC := ::hDC, cDay, nDay, n, dDate, nColStep, nRowStep
local dTmpDate, nMonth := 0, nLeftCol := 0
local nColor, cDate // para evaluar días especiales
local lBrush, nBrush, oBrush
FillRect( hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
nRowStep = ( (::nHeight-3) - ::nTopStart ) / 13
// Uso de Gradient() en vez de GradientFill()
Gradient( ::hDC, { 0, 0, ::nHeight, ::nWidth }, LightColor(250,nClrM), LightColor(200,nClrM), .T. )
dDate = CToD( "01/01/" + Str( ::nYear, 4 ) )
dDate += 8 - DoW( dDate )
nColStep = ( ::nWidth - ::nLeftStart - 3 ) / 37
Gradient( ::hDC, { 0, 0, nRowStep - 1, ::nWidth }, LightColor(225,nClrM), LightColor(175,nClrM), .T. )
::Say( ( ::nTopStart + ( nRowStep / 2 ) - ( ::oFont:nHeight / 2 )),;
( ( ::nLeftStart + nColStep ) / 2 ) - ( GetTextWidth( hDC, Str( ::nYear, 4 ), ::oFont:hFont ) / 2 ),;
Str( ::nYear, 4 ),,, ::oFont, .T., .T. )
// Paint Sunday background color
for n = 1 to 36 step 7
FillRect( hDC, { 0, ::nLeftStart + ( nColStep * n ),;
::nHeight - 1, ::nLeftStart + ( nColStep * ( n + 1 ) ) }, ::oBrushSunday:hBrush )
next
for nMonth = 1 to 12
::Line( ::nTopStart + nMonth * nRowStep, 0,(::nTopStart + nMonth * nRowStep), ::nWidth - 1 )
::Say( ::nTopStart + nMonth * nRowStep + ( nRowStep / 2 ) - ( ::oFont:nHeight / 2 ), 3, cMonth( RegionDate(nMonth, Str( Year( Date() ), 4 ))) ,,, ::oFont, .T., .T. )
next
// fill selected days
if ::lMove
dTmpDate = Min( ::dStart, ::dEnd )
while dTmpDate <= Max( ::dStart, ::dEnd )
nMonth = Month( dTmpDate )
nLeftCol = ::nLeftStart + ( nColStep * ( DOW( RegionDate( nMonth, Str( ::nYear, 4 ) ) ) ) ) + ;
nColStep * ( Day( dTmpDate ) - 1 )
FillRect( hDC, { ::nTopStart + month(dTmpDate) * nRowStep + 1,;
nLeftCol, ::nTopStart + Month( dTmpDate ) * nRowStep + nRowStep,;
nLeftCol + nColStep}, ::oBrushSelected:hBrush )
dTmpDate++
end
endif
// Draw days
for n = 1 to 36
::Line( 0, ::nLeftStart + ( nColStep * n ), ::nHeight - 1, ::nLeftStart + ( nColStep * n ) )
nColor := if( DoW( dDate ) ==1, CLR_RED, 0 )
cDay = SubStr( CDoW( dDate++ ), 1, 1 )
::Say( ( ::nTopStart + nRowStep * 0.4 )-2,;
::nLeftStart + ( nColStep * n ) + ( nColStep / 2 ) - ( GetTextWidth( hDC, cDay, ::oFont:hFont ) / 2 ) + 1,;
cDay, nColor, 0, ::oFont, .T., .T. )
next
// Draw months
for nMonth = 1 to 12
dDate = RegionDate(nMonth,Str( ::nYear, 4 ) )
nDay = DoW( dDate )
while Month( dDate ) == nMonth
cDay = AllTrim( Str( Day( dDate ) ) )
nColor := 0
lBrush :=.F.
cDate := DtoS( dDate)
do case // identifica el día y define el pintado
case DoW( dDate ) == 1; nColor := CLR_RED
case AScan( ::aFIng, cDate ) <> 0; nColor := CLR_WHITE ; lBrush := .T.; nBrush := 2
case AScan( ::aFBaj, cDate ) <> 0; nColor := CLR_WHITE ; lBrush := .T.; nBrush := 3
case AScan( ::aDFal, cDate ) <> 0; nColor := CLR_HRED ; lBrush := .T.; nBrush := 4
case AScan( ::aDInc, cDate ) <> 0; nColor := CLR_YELLOW ; lBrush := .T.; nBrush := 4
case AScan( ::aDVac, cDate ) <> 0; nColor := CLR_BLUE ; lBrush := .T.; nBrush := 5
case AScan( ::aDNLb, cDate ) <> 0; nColor := CLR_HRED ; lBrush := .T.; nBrush := 1
case AScan( ::aDFes, cDate ) <> 0; nColor := CLR_HGREEN ; lBrush := .T.; nBrush := 1
case AScan( ::aDSan, cDate ) <> 0; nColor := CLR_HGREEN ; lBrush := .T.; nBrush := 1
endcase
if lBrush
nMonth = Month( dDate )
nLeftCol = ::nLeftStart + ( nColStep * ( DOW( RegionDate( nMonth, Str( ::nYear, 4 ) ) ) ) ) + ;
nColStep * ( Day( dDate ) - 1 )
do case
case nBrush == 1 ; DEFINE BRUSH oBrush COLOR LightColor(240,nClrM)
case nBrush == 2 ; DEFINE BRUSH oBrush COLOR CLR_BLUE
case nBrush == 3 ; DEFINE BRUSH oBrush COLOR CLR_HRED
case nBrush == 4 ; DEFINE BRUSH oBrush COLOR CLR_RED
case nBrush == 5 ; DEFINE BRUSH oBrush COLOR CLR_HMAGENTA
endcase
FillRect( hDC, { ::nTopStart + month(dDate) * nRowStep + 1,;
nLeftCol + 1, ::nTopStart + Month( dDate ) * nRowStep + nRowStep,;
nLeftCol + nColStep}, oBrush:hBrush )
oBrush:End()
endif
::Say( ( ::nTopStart + nMonth * nRowStep + ( nRowStep * 0.4 ) )-2,;
::nLeftStart + ( nColStep * nDay++ ) + ( nColStep / 2 ) - ( GetTextWidth( hDC, cDay, ::oFont:hFont ) / 2 ) + 1,;
cDay, nColor, 0, ::oFontHeader, .T., .T. )
dDate++
end
next
if ValType( ::bPainted ) == "B"
Eval( ::bPainted, hDC, Min( ::dStart, ::dEnd ), Max( ::dStart, ::dEnd ), Self )
endif
::DispEnd( aInfo )
return 0
//----------------------------------------------------------------------------//
METHOD Destroy() CLASS TPickDate
::oBrushSunday:End()
::oBrushSelected:End()
::oFontHeader:End()
return Super:Destroy()
//----------------------------------------------------------------------------//
METHOD LButtonDown( nRow, nCol, nKeyFlags ) CLASS TPickDate
local nMonth := Int( ( nRow - ::nTopStart ) / ( ( ::nHeight - ::nTopStart ) / 13 ) )
local nDay := Int( ( nCol - ::nLeftStart ) / ( ( ::nWidth - ::nLeftStart ) / 37 ) ) - ;
DoW( RegionDate( nMonth, Str( ::nYear, 4 ) ) ) + 1
if nDay > 0 .and. nMonth > 0 // to work with valid dates only
::dStart := CToD( AllTrim( AllTrim( Str( nDay ) )+ "/" + Str( nMonth ) ) + "/" + Str( ::nYear, 4 ) )
::lMove := .T.
::Refresh( .F. )
endif
return Super:LButtonDown( nRow, nCol, nKeyFlags )
//-----------------------------------------------------------------//
METHOD LButtonUp( nRow, nCol, nKeyFlags ) CLASS TPickDate
if ValType( ::bSelect ) == "B"
Eval( ::bSelect, Min( ::dStart, ::dEnd ), Max( ::dStart, ::dEnd ), Self )
endif
::lMove := .F.
return Super:LButtonUp( nRow, nCol, nKeyFlags )
//-----------------------------------------------------------------//
METHOD MouseMove( nRow, nCol, nKeyFlags ) CLASS TPickDate
local nMonth := Int( ( nRow - ::nTopStart ) / ( ( ::nHeight - ::nTopStart ) / 13 ) )
local nDay := Int( ( nCol - ::nLeftStart ) / ( ( ::nWidth - ::nLeftStart ) / 37 ) ) - ;
DoW( RegionDate( nMonth, Str( ::nYear, 4 ) ) ) + 1
local dEnd
if nDay > 0 .and. nMonth > 0 // to work with valid dates only
dEnd = CToD( AllTrim( Str( nDay ) ) + "/" + AllTrim( Str( nMonth ) ) + "/" + Str( ::nYear, 4 ) )
if ! Empty( dEnd ) .and. dEnd != ::dTemp // for reducing continuous refreshes
::dTemp := dEnd
::dEnd = dEnd
::Refresh( .F. )
if ValType( ::bChange ) == "B"
Eval( ::bChange, Min( ::dStart, ::dEnd ), Max( ::dStart, ::dEnd ), Self )
endif
endif
endif
return Super:MouseMove( nRow, nCol, nKeyFlags )
//-----------------------------------------------------------------//
function RegionDate( nMonth, cYear )
return CToD( "01/" + AllTrim( Str( nMonth ) ) + "/" + cYear )
//-----------------------------------------------------------------//
// LightColor(nDegrade,nColor) para degradar o seleccionar color
#pragma BEGINDUMP
#include <Windows.h>
HARBOUR HB_FUN_LIGHTCOLOR( )
{
COLORREF lColor = hb_parnl(2);
LONG lScale = hb_parni(1);
long R = MulDiv(255-GetRValue(lColor),lScale,255)+GetRValue(lColor);
long G = MulDiv(255-GetGValue(lColor),lScale,255)+GetGValue(lColor);
long B = MulDiv(255-GetBValue(lColor),lScale,255)+GetBValue(lColor);
hb_retnl( RGB(R, G, B) );
}
#pragma ENDDUMP
[/code:1m6o7zpe] |
Calendario anual | [quote="Alfredo Arteaga":230qspah]Alguna vez se publicó el código para determinar las fechas que corresponden a la Semana Santa, me pregunto si alguien lo conserva y puede compartirlo?[/quote:230qspah]No es del foro pero sí lo comparto con gusto:[code:230qspah]//----------------------------------------------------------------------------------------------------//
Function dHollyFriday( nYear )
Local a, b, c, Aa, Bb
a := nYear % 19
b := nYear % 4
c := nYear % 7
Aa := ( ( 19 * a ) + 24 ) % 30
Bb := ( ( 2 * b ) + ( 4 * c ) + ( 6 * Aa ) + 5 ) % 7
Return StoD( LTrim( Str( nYear ) ) + "03" + StrZero( Aa, 2 ) ) + Bb + 22 - 2[/code:230qspah]Un abrazoManuel Mercado |
Calendario anual | Caray Don Manuel, todo un genio!. Se ve tan simple. |
Calendario anual | <!-- m --><a class="postlink" href="http://fivetechsoft.com/forums/viewtopic.php?t=12150&start=30">http://fivetechsoft.com/forums/viewtopi ... 0&start=30</a><!-- m -->METHOD PreviousMonth() and NextMonth() are ready. So you can select a period which is in 2 years, like 1.12.2008 – 31.1.2009. Regards, Otto |
Calendario anual | Manuel excelente la funcion de calculo semana santapara quien quiera mas información[url:2pqvb2zd]http://es.wikipedia.org/wiki/C%C3%A1lculo_de_la_fecha_de_Pascua[/url:2pqvb2zd] |
Calendario anual | [quote="Patricio Avalos Aguirre":1o4iwqgx]para quien quiera mas información[/quote:1o4iwqgx]Les tengo una mala noticia, mi rutina en FiveWin solo funcionará hasta el año 2099, por lo que les agradeceré recordarme con unos meses de anticipación para corregirla. <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> Un abrazo.Manuel Mercado |
Calendario anual | [quote:1d6x0j3i]Les tengo una mala noticia, mi rutina en FiveWin solo funcionará hasta el año 2099, por lo que les agradeceré recordarme con unos meses de anticipación para corregirla.[/quote:1d6x0j3i]Ya tomé nota de ello... te lo recordaré con antecedencia.... <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> Saludos. |
Calendario anual | [quote="Ricardo Ramirez E.":3aum09jk]Ya tomé nota de ello... te lo recordaré con antecedencia.... [/quote:3aum09jk]Gracias Ricardo, pero por favor recorre el recordatorio para el año 2299, <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> aquí tienes la nueva rutina:[code:3aum09jk]Function dHollyFriday( nYear )
Local a, b, c, Aa, Bb, n
n := If( nYear > 2099, 6, If( nYear > 2199, 0, 5 ) )
a := nYear % 19
b := nYear % 4
c := nYear % 7
Aa := ( ( 19 * a ) + 24 ) % 30
Bb := ( ( 2 * b ) + ( 4 * c ) + ( 6 * Aa ) + n ) % 7
Return StoD( LTrim( Str( nYear ) ) + "03" + StrZero( Aa, 2 ) ) + Bb + 22 - 2[/code:3aum09jk]Un abrazo.Manuel Mercado |
Calendario anual | [code:rs7cwyqv]Function dHollyFriday( nYear )
Local a, b, c, Aa, Bb, n
n := If( nYear > 2099, 6, If( nYear > 2199, 0, 5 ) )
a := nYear % 19
b := nYear % 4
c := nYear % 7
Aa := ( ( 19 * a ) + 24 ) % 30
Bb := ( ( 2 * b ) + ( 4 * c ) + ( 6 * Aa ) + n ) % 7
Return StoD( LTrim( Str( nYear ) ) + "03" + StrZero( Aa, 2 ) ) + Bb + 22 - 2[/code:rs7cwyqv]Mejor así:Function dHollyFriday( nYear ) Local a, b, c, Aa, Bb, m, n m := If( nYear > 2099, 24, If( nYear > 2199, 25, 24 ) ) n := If( nYear > 2099, 6, If( nYear > 2199, 0, 5 ) ) a := nYear % 19 b := nYear % 4 c := nYear % 7 Aa := ( ( 19 * a ) + m ) % 30 Bb := ( ( 2 * b ) + ( 4 * c ) + ( 6 * Aa ) + n ) % 7 Return StoD( LTrim( Str( nYear ) ) + "03" + StrZero( Aa, 2 ) ) + Bb + 22 - 2SaludosCarlos G. |
Calendario anual | [quote="FiveWiDi":1uugg64y]Mejor así:[/quote:1uugg64y]Tienes razón Carlos, ahora ya no me preocuparé hasta el 2199, <!-- s:D --><img src="{SMILIES_PATH}/icon_biggrin.gif" alt=":D" title="Very Happy" /><!-- s:D --> la rutina quedó así:[code:1uugg64y]Function dHollyFriday( nYear )
Local a, b, c, Aa, Bb, m, n
m := If( nYear > 2199, 25, 24 )
n := If( nYear > 2099, 6, If( nYear > 2199, 0, 5 ) )
a := nYear % 19
b := nYear % 4
c := nYear % 7
Aa := ( ( 19 * a ) + m ) % 30
Bb := ( ( 2 * b ) + ( 4 * c ) + ( 6 * Aa ) + n ) % 7
Return StoD( LTrim( Str( nYear ) ) + "03" + StrZero( Aa, 2 ) ) + Bb + 20
[/code:1uugg64y]Saudos.Manuel Mercado |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.