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&#58;//rapidshare&#46;com/files/58565980/Event&#46;zip&#46;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&#58;//img143&#46;imageshack&#46;us/my&#46;php?image=immaginems7&#46;jpg:3inz2pfl][img:3inz2pfl]http&#58;//img143&#46;imageshack&#46;us/img143/6248/immaginems7&#46;th&#46;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&#58;//img143&#46;imageshack&#46;us/my&#46;php?image=immaginems7&#46;jpg:1rgnvhhd][img:1rgnvhhd]http&#58;//img143&#46;imageshack&#46;us/img143/6248/immaginems7&#46;th&#46;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&#58;//www&#46;sitasoft&#46;net/fivewin/screen/dateformat&#46;png[/img:308a39qd] using SET DATE TO AMERICAN [img:308a39qd]http&#58;//www&#46;sitasoft&#46;net/fivewin/screen/dateamerican&#46;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&#58;//www&#46;fivetech&#46;com&#46;tw/fwh/ribbonbar_calendar01&#46;jpg[/img:xrt4a3cv] [img:xrt4a3cv]http&#58;//www&#46;fivetech&#46;com&#46;tw/fwh/ribbonbar_calendar02&#46;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;">&#40;</span><span style="color: #000000;">&#41;</span>:<span style="color: #00C800;">New</span><span style="color: #000000;">&#40;</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;">&#41;</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&#58;//imagizer&#46;imageshack&#46;us/v2/640x480q90/922/IjvZTb&#46;jpg[/img:v7sw7rdk] Home Screen [img:v7sw7rdk]http&#58;//imagizer&#46;imageshack&#46;us/v2/640x480q90/921/81RT2K&#46;jpg[/img:v7sw7rdk] Details [img:v7sw7rdk]http&#58;//imagizer&#46;imageshack&#46;us/v2/640x480q90/921/dswGwA&#46;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&#58;//console&#46;developers&#46;google&#46;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&#58;//bitbucket&#46;org/wmanesco/schedule/downloads/client_id&#46;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&#58;//bitbucket&#46;org/wmanesco/schedule/downloads/Schedule&#46;rar[/url:v7sw7rdk] Download JSON File: [url:v7sw7rdk]https&#58;//bitbucket&#46;org/wmanesco/schedule/downloads/client_id&#46;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&#58;//bitbucket&#46;org/wmanesco/schedule/downloads/client_id&#46;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&#58;//img515&#46;imageshack&#46;us/img515/6633/calanualxa1&#46;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&#58;//img294&#46;imageshack&#46;us/img294/9752/calanualrn6&#46;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] &#58;lNoChangeOrd &#58;= &#46;T&#46; [/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&#58;//img387&#46;imageshack&#46;us/my&#46;php?image=screenshotxv6&#46;jpg:3uvhcooe][img:3uvhcooe]http&#58;//img387&#46;imageshack&#46;us/img387/3439/screenshotxv6&#46;th&#46;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&#46;ch" #include "TSBrowse&#46;ch" //--------------------------------------------------------------------------------------------------------------------// Function CalAnual&#40; dDate &#41; Local oDlg, oBrw, nCol, dFecha, nMonth, aLine, bBlock, nDia, nMes, nYear, ; aCale &#58;= &#123;&#125;, ; aMes &#58;= &#123; "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic" &#125;, ; aSem &#58;= &#123; "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" &#125; Default dDate &#58;= Date&#40;&#41; SET DATE BRITISH SET EPOCH TO Year&#40; Date&#40;&#41; &#41; - 70 SetKey&#40; VK_UP, &#123;|| If&#40; GetKeyState&#40; VK_CONTROL &#41;, aSetCale&#40; StoD&#40; Str&#40; --nYear, 4 &#41; + StrZero&#40; nMes, 2 &#41; + ; StrZero&#40; nDia, 2 &#41; &#41;, oBrw, oDlg &#41;, Nil &#41; &#125; &#41; SetKey&#40; VK_DOWN, &#123;|| If&#40; GetKeyState&#40; VK_CONTROL &#41;, aSetCale&#40; StoD&#40; Str&#40; ++nYear, 4 &#41; + StrZero&#40; nMes, 2 &#41; + ; StrZero&#40; nDia, 2 &#41; &#41;, oBrw, oDlg &#41;, Nil &#41; &#125; &#41; nYear &#58;= Year&#40; dDate &#41; aCale &#58;= aSetCale&#40; dDate &#41; nDia &#58;= AScan&#40; aCale&#91; Month&#40; dDate &#41; &#93;, &#123;|e,n| n > 1 &#46;and&#46; e == Day&#40; dDate &#41; &#125; &#41; DEFINE DIALOG oDlg TITLE Str&#40; nYear &#41; SIZE 760, 210 @ 0, 0 BROWSE oBrw ARRAY aCale OF oDlg SIZE 385, 107 PIXEL CELLED ; COLORS CLR_BLACK, &#123;|r,c| If&#40; c == 1, CLR_HGRAY, CLR_WHITE &#41; &#125;, ; &#123; |c| If&#40; c== oBrw&#58;nCell, CLR_WHITE, CLR_BLACK &#41; &#125;, ; &#123; |c| If&#40; c== oBrw&#58;nCell, CLR_BLACK, CLR_HGRAY &#41; &#125;, CLR_WHITE, CLR_BLACK For nCol &#58;= 1 To 38 bBlock &#58;= bDetachable&#40; oBrw, nCol &#41; ADD COLUMN TO oBrw DATA bBlock TITLE aSem&#91; Min&#40; 42, nCol &#41; &#93; SIZE 20 ALIGN DT_RIGHT oBrw&#58;aColumns&#91; nCol &#93;&#58;bGotFocus &#58;= &#123;|| Eval&#40; oBrw&#58;bChange &#41; &#125; Next With Object oBrw &#58;lNoChangeOrd &#58;= &#46;T&#46; &#58;lNoHSCroll &#58;= &#46;T&#46; &#58;lInitGoTop &#58;= &#46;F&#46; &#58;aColumns&#91; 1 &#93;&#58;lFixLite &#58;= &#46;T&#46; &#58;nFreeze &#58;= 1 &#58;lLockFreeze &#58;= &#46;T&#46; &#58;nRowPos &#58;= Month&#40; dDate &#41; &#58;bChange &#58;= &#123; || If&#40; Empty&#40; oBrw&#58;aArray&#91; oBrw&#58;nAt, oBrw&#58;nCell &#93; &#41;, dFecha &#58;= CtoD&#40; "//" &#41;, &#40; ; dFecha &#58;= Ctod&#40; StrZero&#40; nDia &#58;= oBrw&#58;aArray&#91; oBrw&#58;nAt, oBrw&#58;nCell &#93;, 2 &#41; + "/" + ; StrZero&#40; nMes &#58;= oBrw&#58;nAt, 2 &#41; + "/" + Str&#40; nYear &#41; &#41;, oBrw&#58;DrawHeaders&#40;&#41; &#41; &#41; &#125; End With ACTIVATE DIALOG oDlg CENTER ON INIT oBrw&#58;HiliteCell&#40; nDia &#41; Return dFecha //--------------------------------------------------------------------------------------------------------------------// Static Function bDetachable&#40; oBrw, nCol &#41; Return &#123; |uVar| If&#40; uVar == Nil, oBrw&#58;aArray&#91; oBrw&#58;nAt, nCol &#93;, oBrw&#58;aArray&#91; oBrw&#58;nAt, nCol &#93; &#58;= uVar &#41; &#125; //--------------------------------------------------------------------------------------------------------------------// Static Function aSetCale&#40; dDate, oBrw, oDlg &#41; Local aLine, nMonth, nCol, dFecha, nYear, nDia, ; aMes &#58;= &#123; "Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic" &#125;, ; aArr &#58;= &#123;&#125; nYear &#58;= Year&#40; dDate &#41; For nMonth &#58;= 1 To 12 dFecha &#58;= CtoD&#40; "01/" + StrZero&#40; nMonth, 2 &#41; + "/" + Str&#40; nYear &#41; &#41; nCol &#58;= DoW&#40; dFecha &#41; aLine &#58;= Array&#40; 39 &#41; While Month&#40; dFecha &#41; == nMonth aLine&#91; nCol++ &#93; &#58;= Day&#40; dFecha &#41; dFecha ++ EndDo AAdd&#40; aArr, aLine &#41; Next For nCol &#58;= 1 To Len&#40; aArr &#41; ASize&#40; aArr&#91; nCol &#93;, 40 &#41; AIns&#40; aArr&#91; nCol &#93;, 1 &#41; aArr&#91; nCol, 1 &#93; &#58;= aMes&#91; nCol &#93; Next If oBrw != Nil nDia &#58;= AScan&#40; aArr&#91; Month&#40; dDate &#41; &#93;, &#123;|e,n| n > 1 &#46;and&#46; e == Day&#40; dDate &#41; &#125; &#41; oBrw&#58;SetArray&#40; aArr &#41; oBrw&#58;nRowPos &#58;= Month&#40; dDate &#41; oBrw&#58;HiliteCell&#40; nDia &#41; oDlg&#58;SetText&#40; Str&#40; nYear, 4 &#41; &#41; EndIf Return aArr //--------------------------------------------------------------------------------------------------------------------// Static Function StoD&#40; cAnsiDate &#41; Local cFormat &#58;= Upper&#40; Set&#40; _SET_DATEFORMAT &#41; &#41;, ; cYear &#58;= SubStr&#40; cAnsiDate, 1, 4 &#41;, ; cMon &#58;= SubStr&#40; cAnsiDate, 5, 2 &#41;, ; cDay &#58;= SubStr&#40; cAnsiDate, 7, 2 &#41; cFormat &#58;= StrTran&#40; cFormat, "YYYY", cYear &#41; cFormat &#58;= StrTran&#40; cFormat, "YY", Right&#40; cYear, 2 &#41; &#41; cFormat &#58;= StrTran&#40; cFormat, "MM", cMon &#41; cFormat &#58;= StrTran&#40; cFormat, "DD", cDay &#41; Return CtoD&#40; cFormat &#41; [/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&#58;//www&#46;atzwanger&#46;com/fw/pickdate2&#46;jpg[/img:1nhr3jw4][code:1nhr3jw4]#include "fivewin&#46;ch" STATIC oWndPlan STATIC planFont STATIC sX &#58;= 1 STATIC sY &#58;= 1 STATIC sXTemp &#58;= 0 STATIC sYTemp &#58;= 0 STATIC aPlan &#58;= &#123;&#125; STATIC startRow &#58;=0 STATIC startCol &#58;=0 STATIC startDay &#58;="" STATIC oBrush STATIC lMove &#58;=&#46;f&#46; STATIC hBru STATIC hPen STATIC hPen1 STATIC hPen3 STATIC aTemp &#58;= &#123;&#125; STATIC nStartZeile &#58;= 0 function main&#40;&#41; aadd&#40;aTemp,&#123;0,0&#125;&#41; // 1 aadd&#40;aTemp,&#123;0,0&#125;&#41; // 2 aadd&#40;aTemp,&#123;0,0&#125;&#41; // 3 aadd&#40;aTemp,&#123;0,0&#125;&#41; // 4 aadd&#40;aTemp,&#123;0,0&#125;&#41; // 5 aadd&#40;aTemp,&#123;0,0&#125;&#41; // 6 aadd&#40;aTemp,&#123;0,0&#125;&#41; // 7 aadd&#40;aTemp,&#123;0,0&#125;&#41; // 8 aadd&#40;aTemp,&#123;0,0&#125;&#41; // 9 aadd&#40;aTemp,&#123;0,0&#125;&#41; // 10 aadd&#40;aTemp,&#123;0,0&#125;&#41; // 11 aadd&#40;aTemp,&#123;0,0&#125;&#41; // 12 SET DATE GERMAN *** hBru &#58;= CreateSolidBrush&#40; RGB&#40;217,230,246&#41; &#41; hPen &#58;= CreatePen&#40; 0, 1, 12632256 &#41; hPen1 &#58;= CreatePen&#40; 0, 1, 280 &#41; hPen3 &#58;= CreatePen&#40; 0, 18,RGB&#40;183,249,185&#41; &#41;//Sonntagsspalte DEFINE BRUSH oBrush COLOR RGB&#40;255,255,255&#41; DEFINE FONT planFont NAME "ARIAL" SIZE 0,-11 *** DEFINE WINDOW oWndPlan TITLE "Kalender" ; HSCROLL ; FROM 5, 5 TO 24, 98 oWndPlan&#58;bLClicked &#58;= &#123; |y,x,flags | f_bLClicked&#40;y,x&#41; &#125; oWndPlan&#58;bMMoved &#58;= &#123; |y,x,flags | f_MMoved&#40;y,x&#41; &#125; oWndPlan&#58;bLButtonUp &#58;= &#123; |y,x,flags | f_LButtonUp&#40;y,x&#41; &#125; ACTIVATE WINDOW oWndPlan ON PAINT DrawRowLines&#40;&#41; return nil func DrawRowLines &#40;&#41; LOCAL I, nCurrentRows, iZeile LOCAL cHeader1 &#58;= "" LOCAL oSay LOCAL hdc LOCAL aDays &#58;= &#123;; "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" &#125; LOCAL nYear &#58;= YEAR&#40; DATE&#40;&#41; &#41; LOCAL cYear &#58;= STR&#40; nYear, 4 &#41; LOCAL dDate, nStart LOCAL lSchaltJahr &#58;= &#40; DAY&#40; CTOD&#40; "29&#46;02&#46;" + cYear &#41; &#41; <> 0 &#41; LOCAL aDaysInMonth &#58;= &#123; 31, IIF&#40; lSchaltJahr, 29, 28 &#41;, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 &#125; LOCAL nColOffSet &#58;= 10 LOCAL aRect1 LOCAL IMonate &#58;= 0 LOCAL ITemp &#58;= 0 local cTest &#58;= "" local nEnde FOR IMonate &#58;= 1 TO 12 aadd&#40;aPlan,&#123;"","","", "", "", "", "","",; "","", "", "", "", "","",; "","", "", "", "", "","",; "","", "", "", "", "","",; "","", "", "", "", "","","",0,0,0 &#125; &#41; NEXT aRect1 &#58;= &#123; 0,0,500,1000&#125; FillRect&#40;oWndPlan&#58;hDc,aRect1,oBrush&#58;hBrush&#41; iZeile &#58;= 0 nCurrentRows &#58;= 30 FOR I &#58;= 1 TO 13 SelectObject&#40; oWndPlan&#58;hDc, hPen &#41; IF iZeile = 5 SelectObject&#40; oWndPlan&#58;hDc, hPen1 &#41; iZeile &#58;= 0 ENDIF //Lines oWndPlan&#58;line &#40;nCurrentRows, 1,nCurrentRows, 726 &#41; nCurrentRows &#58;= nCurrentRows + 18 iZeile &#58;= iZeile + 1 NEXT nCurrentRows&#58;= 50 FOR I &#58;= 1 TO 38 SelectObject&#40; oWndPlan&#58;hDc, hPen &#41; IF iZeile = 5 SelectObject&#40; oWndPlan&#58;hDc, hPen1 &#41; iZeile &#58;= 0 ENDIF oWndPlan&#58;line &#40;10,nColOffSet + nCurrentRows,400, nColOffSet + nCurrentRows &#41; nCurrentRows &#58;= nCurrentRows + 18 iZeile &#58;= iZeile + 1 NEXT nCurrentRows&#58;= 50 FOR I &#58;= 1 TO len&#40;aDays&#41; if aDays&#91;I&#93; = "So" //Farbhintergrund Sonntag SelectObject&#40; oWndPlan&#58;hDc, hPen3 &#41; // Sonntag erste fette Linie oWndPlan&#58;line &#40;0,nColOffSet+ 10 + nCurrentRows,400, nColOffSet+ 10 + nCurrentRows &#41; SelectObject&#40; oWndPlan&#58;hDc, hPen &#41; oWndPlan&#58;say&#40; 8, nColOffSet+36+I*18,aDays&#91;I&#93;,RGB&#40;255,128,0&#41;, RGB&#40;125,236,175&#41;,planFont,&#46;T&#46;&#41; else oWndPlan&#58;say&#40; 8, nColOffSet+36+I*18,aDays&#91;I&#93;,RGB&#40;255,128,0&#41;,16777215,planFont,&#46;T&#46;&#41; endif nCurrentRows &#58;= nCurrentRows + 18 NEXT nCurrentRows &#58;= 12 FOR I &#58;= 1 TO 12 SelectObject&#40; oWndPlan&#58;hDc, hPen &#41; IF iZeile = 5 SelectObject&#40; oWndPlan&#58;hDc, hPen1 &#41; iZeile &#58;= 0 ENDIF nCurrentRows &#58;= nCurrentRows + 18 dDate &#58;= CTOD&#40; "01&#46;" + PADL&#40; ALLTRIM&#40;STR&#40; i, 2 &#41;&#41;, 2, "0" &#41; + "&#46;" + cYear &#41; nStart &#58;= DOW&#40; dDate &#41; aPlan&#91;I,38&#93; &#58;= nStart aPlan&#91;I,39&#93; &#58;= 30-18+ &#40;18*&#40; aDaysInMonth&#91;i&#93; + nStart - 1 &#41;&#41; //col begin of month aPlan&#91;I,40&#93; &#58;= nStart + aDaysInMonth&#91;i&#93; //col end of month FOR iZeile &#58;= nStart TO aDaysInMonth&#91;i&#93; + nStart - 1 aPlan&#91;I,iZeile&#93; = &#40; PADL&#40; ALLTRIM&#40;STR&#40; &#40;iZeile-nStart+1&#41;, 2 &#41;&#41;, 2, "0" &#41;+ "&#46;" + PADL&#40; ALLTRIM&#40;STR&#40; &#40;I&#41;, 2 &#41;&#41;, 2, "0" &#41; + "&#46;" + cYear &#41; NEXT cHeader1 &#58;= OemToAnsi&#40; CMONTH&#40; dDate &#41; &#41; //Monate oWndPlan&#58;say&#40; nCurrentRows+1, 2, cHeader1,RGB&#40;63,63,63&#41;,16777215,planFont,&#46;T&#46;&#41; NEXT IF &#40;sy > 0 &#46;AND&#46; sy < 13&#41; &#46;AND&#46; &#40;sx > 0 &#46;AND&#46; sx < 38&#41; IF lMove = &#46;t&#46; IZeile &#58;= INT&#40;&#40;syTemp-30&#41;/18 &#41; + 1 aTemp&#91;IZeile,1&#93;&#58;=10 FOR ITemp &#58;= IZeile+1 TO 12 aTemp&#91;ITemp,1&#93;&#58;=0 NEXT FOR ITemp &#58;= 1 TO 12 if aTemp&#91;ITemp,1&#93; > 0 if sXTemp > aPlan&#91;ITemp,39&#93; + aPlan&#91;ITemp,38&#93;*18 sXTemp &#58;= aPlan&#91;ITemp,39&#93; + aPlan&#91;ITemp,38&#93;*18 endif IF 30-18+ &#40;18*&#40;ITemp&#41;&#41; >= startCol &#46;AND&#46; ; &#46;NOT&#46; &#40;30-18+ &#40;18*&#40;ITemp&#41;&#41; = startCol &#46;AND&#46; ; startRow > sXTemp&#41; FillRect&#40; oWndPlan&#58;hDc, &#123; 30-18+ &#40;18*&#40;ITemp&#41;&#41;,startRow, 30 +&#40;18*&#40;ITemp&#41;&#41;, sXTemp&#125;, hBru &#41; IF ITemp > nStartZeile FillRect&#40; oWndPlan&#58;hDc, &#123; 30-18+ &#40;18*&#40;ITemp-1&#41;&#41;,startRow, 30 +&#40;18*&#40;ITemp-1&#41;&#41;, &#40;30 +&#40; 13 + 18*&#40;aPlan&#91;ITemp-1,40&#93;&#41;&#41;&#41; &#125;, hBru &#41; FillRect&#40; oWndPlan&#58;hDc, &#123; 30-18+ &#40;18*&#40;ITemp&#41;&#41;, 30 + 13 + &#40;18*&#40;aPlan&#91;ITemp,38&#93;&#41;&#41;, 30 +&#40;18*&#40;ITemp&#41;&#41;, sXTemp&#125;, hBru &#41; ENDIF else FillRect&#40; oWndPlan&#58;hDc, &#123;startCol,startRow,startCol+18,startRow+18&#125;, hBru &#41; ENDIF endif NEXT ENDIF ENDIF nCurrentRows &#58;= 12 FOR I &#58;= 1 TO 12 SelectObject&#40; oWndPlan&#58;hDc, hPen &#41; IF iZeile = 5 SelectObject&#40; oWndPlan&#58;hDc, hPen1 &#41; iZeile &#58;= 0 ENDIF nCurrentRows &#58;= nCurrentRows + 18 dDate &#58;= CTOD&#40; "01&#46;" + PADL&#40; ALLTRIM&#40;STR&#40; i, 2 &#41;&#41;, 2, "0" &#41; + "&#46;" + cYear &#41; nStart &#58;= DOW&#40; dDate &#41; aPlan&#91;I,38&#93; &#58;= nStart aPlan&#91;I,39&#93; &#58;= 30-18+ &#40;18*&#40; aDaysInMonth&#91;i&#93; + nStart - 1 &#41;&#41; //col begin of month aPlan&#91;I,40&#93; &#58;= nStart + aDaysInMonth&#91;i&#93; //col end of month FOR iZeile &#58;= nStart TO aDaysInMonth&#91;i&#93; + nStart - 1 cHeader1 &#58;= ALLTRIM&#40;str&#40;iZeile-nStart+1&#41;&#41; //Tage if aDays&#91;iZeile&#93; = "So" oWndPlan&#58;say&#40; nCurrentRows+3,36 + nColOffSet + &#40;iZeile&#41; *18, ; cHeader1, RGB&#40;63,63,63&#41;,RGB&#40;125,236,175&#41;,planFont,&#46;T&#46;,&#46;T&#46;&#41; else oWndPlan&#58;say&#40; nCurrentRows+3,36 + nColOffSet + &#40;iZeile&#41; *18, ; cHeader1, RGB&#40;63,63,63&#41;,16777215,planFont,&#46;T&#46;, &#46;T&#46;&#41; ENDIF NEXT NEXT IF &#40;sy > 0 &#46;AND&#46; sy < 13&#41; &#46;AND&#46; &#40;sx > 0 &#46;AND&#46; sx < 38&#41; oWndPlan&#58;say&#40;syTemp+20, sxTemp-20, aPlan&#91;sy, sx&#93; + " # "+str&#40;ctod&#40;aPlan&#91;sy, sx&#93;&#41;-ctod&#40;startDay&#41;+ 1&#41;, RGB&#40;63,63,63&#41;, RGB&#40;125,236,175&#41;, planFont, &#46;T&#46; &#41; endif return nil func f_LButtonUp&#40;y,x&#41; msginfo&#40;startDay + " -- " + aPlan&#91;sy, sx&#93; + " Tage&#58; " + str&#40; ctod&#40;aPlan&#91;sy, sx&#93;&#41;-ctod&#40;startDay&#41; +1 &#41;&#41; lMove&#58;=&#46;f&#46; return nil func f_MMoved&#40;y,x&#41; IF sy <> &#40;INT&#40;&#40;y-30&#41;/18 &#41; + 1&#41; &#46;OR&#46; sy <> &#40;INT&#40; &#40;x-50-10&#41;/18 &#41; + 1 &#41; sy &#58;= INT&#40;&#40;y-30&#41;/18 &#41; + 1 sx &#58;= INT&#40;&#40;x-50-10&#41;/18 &#41; + 1 IF y < 30 sy &#58;= 0 y &#58;= 0 ENDIF syTemp &#58;= y sxTemp &#58;= 59 + sx * 18 oWndPlan&#58;refresh&#40;&#41; ENDIF return nil func f_bLClicked&#40;y,x&#41; local ITemp&#58;=0 sy &#58;= INT&#40;&#40;y-30&#41;/18 &#41; + 1 sx &#58;= INT&#40;&#40;x-50-10&#41;/18 &#41; + 1 startDay &#58;= aPlan&#91;sy, sx&#93; nStartZeile &#58;= sy startRow &#58;= INT&#40;&#40;x - 30&#41;/18&#41;*18 + 18 + 7 startCol &#58;= &#40;INT&#40;&#40;y-30&#41;/18 &#41;&#41;*18 + 30 FOR ITemp &#58;= 1 TO 12 aTemp&#91;ITemp,1&#93;&#58;=0 NEXT FillRect&#40; oWndPlan&#58;hDc, &#123;startCol,startRow,startCol+18,startRow+18&#125;, hBru &#41; oWndPlan&#58;refresh&#40;&#41; lMove&#58;=&#46;t&#46; 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&#46; #include "FiveWin&#46;ch" //----------------------------------------------------------------------------// function Main&#40;&#41; LOCAL oPickDate oPickDate &#58;= TPickdate&#40;&#41;&#58;New&#40;&#41; oPickDate&#58;nWidth &#58;= 14 oPickDate&#58;nHeight &#58;= 30 msginfo&#40;oPickDate&#58;GetDate&#40;&#41;&#41; oPickDate&#58;end&#40;&#41; return nil ******************************************************************************** *** CLASS Tpickdate ******************************************************************************** //----------------------------------------------------------------------------// #include "FiveWin&#46;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&#40;&#41; method PreviousYear&#40;&#41; method NextYear&#40;&#41; method GetDate&#40;&#41; method LButtonUp&#40;x,y&#41; method bLClicked&#40;x,y&#41; method DrawRowLines &#40;&#41; method MMoved&#40;x,y&#41; METHOD End&#40;&#41; ENDCLASS //-----------------------------------------------------------------// METHOD New&#40;&#41; CLASS Tpickdate &#58;&#58;VERSION &#58;= "1&#46;0&#46;0" &#58;&#58;nWidth &#58;= 10 &#58;&#58;nHeight &#58;= 10 &#58;&#58;nStartCols &#58;= 50 &#58;&#58;nStartRow &#58;= 30 &#58;&#58;nYear &#58;= YEAR&#40; DATE&#40;&#41; &#41; &#58;&#58;hBru &#58;= CreateSolidBrush&#40; RGB&#40;217,230,246&#41; &#41; &#58;&#58;hPen &#58;= CreatePen&#40; 0, 1, 12632256 &#41; &#58;&#58;hPen1 &#58;= CreatePen&#40; 0, 1, 280 &#41; &#58;&#58;hPen3 &#58;= CreatePen&#40; 0, &#58;&#58;nWidth,RGB&#40;183,249,185&#41; &#41; //Sonntagsspalte DEFINE BRUSH &#58;&#58;oBrush COLOR RGB&#40;255,255,255&#41; DEFINE FONT &#58;&#58;planFont NAME "ARIAL" SIZE 0,-11 &#58;&#58;sy &#58;= 1 &#58;&#58;sx &#58;= 1 &#58;&#58;syTemp &#58;= 0 &#58;&#58;sxTemp &#58;= 0 &#58;&#58;aPlan &#58;= &#123;&#125; &#58;&#58;ClickCol &#58;= 0 &#58;&#58;ClickRow &#58;= 0 &#58;&#58;startDay &#58;= "" &#58;&#58;endDay &#58;= "" &#58;&#58;lMove &#58;= &#46;f&#46; &#58;&#58;aTemp &#58;= &#123;&#125; &#58;&#58;nStartZeile &#58;= 0 aadd&#40;&#58;&#58;aTemp,&#123;0,0&#125;&#41; // 1 aadd&#40;&#58;&#58;aTemp,&#123;0,0&#125;&#41; // 2 aadd&#40;&#58;&#58;aTemp,&#123;0,0&#125;&#41; // 3 aadd&#40;&#58;&#58;aTemp,&#123;0,0&#125;&#41; // 4 aadd&#40;&#58;&#58;aTemp,&#123;0,0&#125;&#41; // 5 aadd&#40;&#58;&#58;aTemp,&#123;0,0&#125;&#41; // 6 aadd&#40;&#58;&#58;aTemp,&#123;0,0&#125;&#41; // 7 aadd&#40;&#58;&#58;aTemp,&#123;0,0&#125;&#41; // 8 aadd&#40;&#58;&#58;aTemp,&#123;0,0&#125;&#41; // 9 aadd&#40;&#58;&#58;aTemp,&#123;0,0&#125;&#41; // 10 aadd&#40;&#58;&#58;aTemp,&#123;0,0&#125;&#41; // 11 aadd&#40;&#58;&#58;aTemp,&#123;0,0&#125;&#41; // 12 SET DATE GERMAN return Self //----------------------------------------------------------------------------// method GetDate&#40;&#41; local cZeitraum &#58;= "" local oSelf&#58;= Self &#58;&#58;hPen3 &#58;= CreatePen&#40; 0, &#58;&#58;nWidth,RGB&#40;183,249,185&#41; &#41; //Sonntagsspalte DEFINE WINDOW &#58;&#58;oWnd TITLE "Kalender" ; VSCROLL ; FROM 5, 5 TO 24, 98 &#58;&#58;oWnd&#58;bLClicked &#58;= &#123; |x,y,flags | &#58;&#58;bLClicked&#40;x,y&#41; &#125; &#58;&#58;oWnd&#58;bMMoved &#58;= &#123; |x,y,flags | &#58;&#58;MMoved&#40;x,y&#41; &#125; &#58;&#58;oWnd&#58;bLButtonUp &#58;= &#123; |x,y,flags | &#58;&#58;LButtonUp&#40;x,y&#41; &#125; &#58;&#58;oWnd&#58;cTitle &#58;= "Kalender &#91; " + str&#40;&#58;&#58;nYear,4&#41; + " &#93;" &#58;&#58;oWnd&#58;oVScroll&#58;bGoUp &#58;= &#123;|| &#58;&#58;PreviousYear&#40;&#41; &#125; &#58;&#58;oWnd&#58;oVScroll&#58;bGoDown &#58;= &#123;|| &#58;&#58;NextYear&#40;&#41; &#125; ACTIVATE WINDOW &#58;&#58;oWnd ON INIT &#40;oSelf&#58;oWnd&#58;nWidth&#40; oSelf&#58;nStartCols + 38 * oSelf&#58;nWidth + oSelf&#58;nWidth + oSelf&#58;nWidth&#41;,; oSelf&#58;oWnd&#58;nHeight&#40;oSelf&#58;nStartRow + 13 * oSelf&#58;nHeight &#41; &#41;; ON PAINT &#58;&#58;DrawRowLines&#40;&#41; VALID &#40;&#40;cZeitraum &#58;= &#58;&#58;startDay + " -- " + &#58;&#58;endDay + " Tage&#58; " + str&#40; ctod&#40;&#58;&#58;endDay&#41;-ctod&#40;&#58;&#58;startDay&#41; +1 &#41;&#41;,&#46;t&#46;&#41; return &#40;cZeitraum&#41; //-----------------------------------------------------------------// method PreviousYear&#40;&#41; &#58;&#58;nYear &#58;= &#58;&#58;nYear - 1 &#58;&#58;DrawRowLines&#40;&#41; &#58;&#58;oWnd&#58;refresh&#40;&#41; &#58;&#58;oWnd&#58;cTitle &#58;= "Kalender &#91; " + str&#40;&#58;&#58;nYear,4&#41; + " &#93;" return &#46;t&#46; //-----------------------------------------------------------------// method NextYear&#40;&#41; &#58;&#58;nYear &#58;= &#58;&#58;nYear + 1 &#58;&#58;DrawRowLines&#40;&#41; &#58;&#58;oWnd&#58;refresh&#40;&#41; &#58;&#58;oWnd&#58;cTitle &#58;= "Kalender &#91; " + str&#40;&#58;&#58;nYear,4&#41; + " &#93;" return &#46;t&#46; //-----------------------------------------------------------------// method LButtonUp&#40;x,y&#41; &#58;&#58;endDay &#58;= &#58;&#58;aPlan&#91;&#58;&#58;sx,&#58;&#58;sy&#93; IF &#58;&#58;sy > 0 &#46;AND&#46; &#58;&#58;sx > 0 if msgYesNo&#40;&#58;&#58;startDay + " -- " + &#58;&#58;endDay + " Tage&#58; " + str&#40; ctod&#40;&#58;&#58;endDay&#41;-ctod&#40;&#58;&#58;startDay&#41; +1 &#41;&#41;=&#46;t&#46; &#58;&#58;oWnd&#58;end&#40;&#41; endif ENDIF &#58;&#58;lMove&#58;=&#46;f&#46; return nil //-----------------------------------------------------------------// method bLClicked&#40;x,y&#41; local ITemp &#58;= 0 &#58;&#58;sx &#58;= INT&#40;&#40;x - &#58;&#58;nStartRow&#41;/&#58;&#58;nHeight &#41; + 1 &#58;&#58;sy &#58;= INT&#40;&#40;y - &#58;&#58;nStartCols&#41;/&#58;&#58;nWidth &#41; IF &#58;&#58;sy > 0 &#46;AND&#46; &#58;&#58;sx > 0 &#58;&#58;startDay &#58;= &#58;&#58;aPlan&#91;&#58;&#58;sx,&#58;&#58;sy&#93; &#58;&#58;nStartZeile &#58;= &#58;&#58;sx &#58;&#58;ClickRow &#58;= &#40;INT&#40;&#40;x-&#58;&#58;nStartRow&#41;/&#58;&#58;nHeight &#41;&#41;*&#58;&#58;nHeight + &#58;&#58;nStartRow &#58;&#58;ClickCol &#58;= &#58;&#58;nStartCols + &#58;&#58;sy * &#58;&#58;nWidth FOR ITemp &#58;= 1 TO 12 &#58;&#58;aTemp&#91;ITemp,1&#93;&#58;=0 NEXT &#58;&#58;oWnd&#58;refresh&#40;&#41; &#58;&#58;lMove&#58;=&#46;t&#46; ENDIF return nil //-----------------------------------------------------------------// method DrawRowLines &#40;&#41; local aInfo &#58;= &#58;&#58;oWnd&#58;DispBegin&#40;&#41; local I, nCurrentRows, iZeile local nCurrentCol local cHeader1 &#58;= "" local oSay local hdc local aDays &#58;= &#123;; "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" &#125; local cYear &#58;= STR&#40; &#58;&#58;nYear, 4 &#41; local dDate, nStart local lSchaltJahr &#58;= &#40; DAY&#40; CTOD&#40; "29&#46;02&#46;" + cYear &#41; &#41; <> 0 &#41; local aDaysInMonth &#58;= &#123; 31, IIF&#40; lSchaltJahr, 29, 28 &#41;, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 &#125; local aRect1 local IMonate &#58;= 0 local ITemp &#58;= 0 local cTest &#58;= "" local nEnde local iSpalte &#58;= 0 local nRight local nBottom local nLeft local nTop FOR IMonate &#58;= 1 TO 12 aadd&#40;&#58;&#58;aPlan,&#123;"","","", "", "", "", "","",; "","", "", "", "", "","",; "","", "", "", "", "","",; "","", "", "", "", "","",; "","", "", "", "", "","","",0,0,0 &#125; &#41; NEXT aRect1 &#58;= &#123; 0,0, &#58;&#58;nStartRow + &#40;13 * &#58;&#58;nHeight&#41; ,&#58;&#58;nStartCols + &#40;38 * &#58;&#58;nWidth&#41; + &#58;&#58;nWidth&#125; //procl FillRect&#40;&#58;&#58;oWnd&#58;hDc,aRect1,&#58;&#58;oBrush&#58;hBrush&#41; iZeile &#58;= 0 nCurrentCol &#58;= &#58;&#58;nStartCols FOR I &#58;= 1 TO 38 SelectObject&#40; &#58;&#58;oWnd&#58;hDc, &#58;&#58;hPen &#41; IF iZeile = 5 SelectObject&#40; &#58;&#58;oWnd&#58;hDc, &#58;&#58;hPen1 &#41; iZeile &#58;= 0 ENDIF //vertikale Linie zw&#46; Tage &#58;&#58;oWnd&#58;line &#40;10, &#58;&#58;nWidth + nCurrentCol, &#58;&#58;nStartRow + &#40;13 * &#58;&#58;nHeight&#41;, &#58;&#58;nWidth + nCurrentCol &#41; nCurrentCol &#58;= nCurrentCol + &#58;&#58;nWidth iZeile &#58;= iZeile + 1 NEXT nCurrentCol &#58;= &#58;&#58;nStartCols FOR I &#58;= 1 TO len&#40;aDays&#41; if aDays&#91;I&#93; = "So" //Farbhintergrund Sonntag SelectObject&#40; &#58;&#58;oWnd&#58;hDc, &#58;&#58;hPen3 &#41; // Sonntag erste fette Linie &#58;&#58;oWnd&#58;line &#40;0, &#58;&#58;nWidth + &#58;&#58;nWidth/2 + nCurrentCol,&#58;&#58;nStartRow + &#40;13 * &#58;&#58;nHeight&#41;, &#58;&#58;nWidth + &#58;&#58;nWidth/2 + nCurrentCol &#41; SelectObject&#40; &#58;&#58;oWnd&#58;hDc, &#58;&#58;hPen &#41; &#58;&#58;oWnd&#58;say&#40; 8, &#58;&#58;nWidth+36+I* &#58;&#58;nWidth,aDays&#91;I&#93;,RGB&#40;255,128,0&#41;, RGB&#40;125,236,175&#41;,&#58;&#58;planFont,&#46;T&#46;&#41; else &#58;&#58;oWnd&#58;say&#40; 8, &#58;&#58;nWidth+36+I*&#58;&#58;nWidth,aDays&#91;I&#93;,RGB&#40;255,128,0&#41;,16777215,&#58;&#58;planFont,&#46;T&#46;&#41; endif nCurrentCol &#58;= nCurrentCol + &#58;&#58;nWidth NEXT nCurrentRows &#58;= &#58;&#58;nStartRow FOR I &#58;= 1 TO 13 SelectObject&#40; &#58;&#58;oWnd&#58;hDc, &#58;&#58;hPen &#41; IF iZeile = 5 SelectObject&#40; &#58;&#58;oWnd&#58;hDc, &#58;&#58;hPen1 &#41; iZeile &#58;= 0 ENDIF //Lines &#58;&#58;oWnd&#58;line &#40;nCurrentRows, 1,nCurrentRows, &#58;&#58;nStartCols+ 38 * &#58;&#58;nWidth &#41; //726 nCurrentRows &#58;= nCurrentRows + &#58;&#58;nHeight iZeile &#58;= iZeile + 1 NEXT nCurrentRows &#58;= 12 FOR I &#58;= 1 TO 12 SelectObject&#40; &#58;&#58;oWnd&#58;hDc, &#58;&#58;hPen &#41; IF iZeile = 5 SelectObject&#40; &#58;&#58;oWnd&#58;hDc, &#58;&#58;hPen1 &#41; iZeile &#58;= 0 ENDIF nCurrentRows &#58;= nCurrentRows + &#58;&#58;nHeight dDate &#58;= CTOD&#40; "01&#46;" + PADL&#40; ALLTRIM&#40;STR&#40; i, 2 &#41;&#41;, 2, "0" &#41; + "&#46;" + cYear &#41; nStart &#58;= DOW&#40; dDate &#41; &#58;&#58;aPlan&#91;I,38&#93; &#58;= nStart &#58;&#58;aPlan&#91;I,39&#93; &#58;= &#58;&#58;nStartCols + &#58;&#58;nWidth * nStart //- &#58;&#58;nWidth //col begin of month &#58;&#58;aPlan&#91;I,40&#93; &#58;= nStart + aDaysInMonth&#91;i&#93; //col end of month FOR iSpalte &#58;= nStart TO aDaysInMonth&#91;i&#93; + nStart - 1 &#58;&#58;aPlan&#91;I,iSpalte&#93; = &#40; PADL&#40; ALLTRIM&#40;STR&#40; &#40;iSpalte-nStart+1&#41;, 2 &#41;&#41;, 2, "0" &#41;+ "&#46;" + PADL&#40; ALLTRIM&#40;STR&#40; &#40;I&#41;, 2 &#41;&#41;, 2, "0" &#41; + "&#46;" + cYear &#41; NEXT cHeader1 &#58;= OemToAnsi&#40; CMONTH&#40; dDate &#41; &#41;//Monate &#58;&#58;oWnd&#58;say&#40; nCurrentRows+1, 2, cHeader1,RGB&#40;63,63,63&#41;,16777215,&#58;&#58;planFont,&#46;T&#46;&#41; NEXT IF &#40;&#58;&#58;sx > 0 &#46;AND&#46; &#58;&#58;sx < 13&#41; &#46;AND&#46; &#40;&#58;&#58;sy > 0 &#46;AND&#46; &#58;&#58;sy < 38&#41; IF &#58;&#58;lMove = &#46;t&#46; IZeile &#58;= &#58;&#58;sx &#58;&#58;aTemp&#91;IZeile,1&#93; &#58;= 10 FOR ITemp &#58;= IZeile+1 TO 12 &#58;&#58;aTemp&#91;ITemp,1&#93; &#58;= 0 NEXT FOR ITemp &#58;= 1 TO 12 if &#58;&#58;aTemp&#91;ITemp,1&#93; > 0 IF ctod&#40;&#58;&#58;aPlan&#91;&#58;&#58;sx,&#58;&#58;sy&#93;&#41; > ctod&#40;" &#46; &#46; "&#41; FillRect&#40; &#58;&#58;oWnd&#58;hDc, &#123;&#58;&#58;ClickRow,; &#58;&#58;ClickCol,; &#58;&#58;ClickRow+&#58;&#58;nHeight,; &#58;&#58;ClickCol+&#58;&#58;nWidth&#125;, &#58;&#58;hBru &#41; IF &#58;&#58;nStartRow-&#58;&#58;nHeight + &#40;&#58;&#58;nHeight*&#40;ITemp&#41;&#41; = &#58;&#58;ClickRow &#46;OR&#46; IZeile=1 nTop &#58;= &#58;&#58;nStartRow - &#58;&#58;nHeight + &#40;&#58;&#58;nHeight*&#40;ITemp&#41;&#41; nLeft &#58;= &#58;&#58;ClickCol IF &#58;&#58;ClickCol < &#58;&#58;aPlan&#91;ITemp,39&#93; nLeft &#58;= &#58;&#58;aPlan&#91;ITemp,39&#93; ENDIF nBottom &#58;= &#58;&#58;nStartRow + &#40;&#58;&#58;nHeight*&#40;ITemp&#41;&#41; nRight &#58;= &#58;&#58;syTemp IF &#58;&#58;syTemp > nLeft IF &#58;&#58;syTemp <= &#58;&#58;nStartCols+&#58;&#58;aPlan&#91;ITemp,40&#93;*&#58;&#58;nWidth FillRect&#40; &#58;&#58;oWnd&#58;hDc, &#123;nTop,; nLeft,; nBottom,; nRight &#125;,&#58;&#58;hBru&#41; ENDIF ENDIF ELSEIF ITemp > &#58;&#58;nStartZeile ********** IF ITemp > &#58;&#58;nStartZeile+1 nTop &#58;= &#58;&#58;nStartRow - &#58;&#58;nHeight + &#40;&#58;&#58;nHeight*&#40;ITemp-1&#41;&#41; nLeft &#58;= &#58;&#58;aPlan&#91;ITemp-1,39&#93; nBottom &#58;= &#58;&#58;nStartRow + &#40;&#58;&#58;nHeight*&#40;ITemp-1&#41;&#41; nRight &#58;= &#58;&#58;nStartCols +&#40; &#58;&#58;nWidth*&#40;&#58;&#58;aPlan&#91;ITemp-1,40&#93;&#41;&#41; IF &#58;&#58;syTemp >= &#58;&#58;aPlan&#91;ITemp,39&#93; IF &#58;&#58;syTemp <= &#58;&#58;nStartCols+&#58;&#58;aPlan&#91;ITemp,40&#93;*&#58;&#58;nWidth FillRect&#40; &#58;&#58;oWnd&#58;hDc, &#123;nTop,; nLeft,; nBottom,; nRight &#125;,&#58;&#58;hBru&#41; ENDIF ENDIF ENDIF *********** nTop &#58;= &#58;&#58;nStartRow - &#58;&#58;nHeight + &#40;&#58;&#58;nHeight*&#40;ITemp&#41;&#41; nLeft &#58;= &#58;&#58;aPlan&#91;ITemp,39&#93; nBottom &#58;= &#58;&#58;nStartRow + &#40;&#58;&#58;nHeight*&#40;ITemp&#41;&#41; nRight &#58;= &#58;&#58;syTemp IF &#58;&#58;syTemp >= &#58;&#58;aPlan&#91;ITemp,39&#93; IF &#58;&#58;syTemp <= &#58;&#58;nStartCols+&#58;&#58;aPlan&#91;ITemp,40&#93;*&#58;&#58;nWidth FillRect&#40; &#58;&#58;oWnd&#58;hDc, &#123;nTop,; nLeft,; nBottom,; nRight &#125;,&#58;&#58;hBru&#41; ENDIF ENDIF nTop &#58;= &#58;&#58;nStartRow-&#58;&#58;nHeight+ &#40;&#58;&#58;nHeight*&#40;ITemp-1&#41;&#41; nLeft &#58;= &#58;&#58;ClickCol IF &#58;&#58;ClickCol < &#58;&#58;aPlan&#91;ITemp-1,39&#93; nLeft &#58;= &#58;&#58;aPlan&#91;ITemp-1,39&#93; ENDIF nBottom &#58;= &#58;&#58;nStartRow +&#40;&#58;&#58;nHeight*&#40;ITemp-1&#41;&#41; nRight &#58;= &#58;&#58;nStartCols +&#40; &#58;&#58;nWidth*&#40;&#58;&#58;aPlan&#91;ITemp-1,40&#93;&#41;&#41; FillRect&#40; &#58;&#58;oWnd&#58;hDc, &#123;nTop,; nLeft,; nBottom,; nRight &#125;, &#58;&#58;hBru &#41; else ENDIF ENDIF endif NEXT ENDIF ENDIF nCurrentRows &#58;= 12 FOR I &#58;= 1 TO 12 SelectObject&#40; &#58;&#58;oWnd&#58;hDc, &#58;&#58;hPen &#41; IF iZeile = 5 SelectObject&#40; &#58;&#58;oWnd&#58;hDc, &#58;&#58;hPen1 &#41; iZeile &#58;= 0 ENDIF nCurrentRows &#58;= nCurrentRows + &#58;&#58;nHeight dDate &#58;= CTOD&#40; "01&#46;" + PADL&#40; ALLTRIM&#40;STR&#40; i, 2 &#41;&#41;, 2, "0" &#41; + "&#46;" + cYear &#41; nStart &#58;= DOW&#40; dDate &#41; FOR iZeile &#58;= nStart TO aDaysInMonth&#91;i&#93; + nStart - 1 cHeader1 &#58;= ALLTRIM&#40;str&#40;iZeile-nStart+1&#41;&#41; //Tage if aDays&#91;iZeile&#93; = "So" &#58;&#58;oWnd&#58;say&#40; nCurrentRows+3,36 + &#58;&#58;nWidth + &#40;iZeile&#41; * &#58;&#58;nWidth, cHeader1, RGB&#40;63,63,63&#41;,RGB&#40;125,236,175&#41;,&#58;&#58;planFont,&#46;T&#46;,&#46;T&#46;&#41; else &#58;&#58;oWnd&#58;say&#40; nCurrentRows+3,36 + &#58;&#58;nWidth + &#40;iZeile&#41; * &#58;&#58;nWidth, cHeader1, RGB&#40;63,63,63&#41;,16777215,&#58;&#58;planFont,&#46;T&#46;, &#46;T&#46;&#41; ENDIF NEXT NEXT IF &#40;&#58;&#58;sx > 0 &#46;AND&#46; &#58;&#58;sx < 13&#41; &#46;AND&#46; &#40;&#58;&#58;sy > 0 &#46;AND&#46; &#58;&#58;sy < 38&#41; &#58;&#58;oWnd&#58;say&#40;&#58;&#58;sxTemp+20, &#58;&#58;syTemp-20, &#58;&#58;aPlan&#91;&#58;&#58;sx,&#58;&#58;sy&#93; + " # "+str&#40;ctod&#40;&#58;&#58;aPlan&#91;&#58;&#58;sx,&#58;&#58;sy&#93;&#41;-ctod&#40;&#58;&#58;startDay&#41;+ 1&#41;, RGB&#40;63,63,63&#41;, RGB&#40;125,236,175&#41;, &#58;&#58;planFont, &#46;T&#46; &#41; endif &#58;&#58;oWnd&#58;DispEnd&#40; aInfo &#41; return nil //-----------------------------------------------------------------// method MMoved&#40;x,y&#41; IF &#58;&#58;sx <> &#40;INT&#40;&#40;x-&#58;&#58;nStartRow&#41;/&#58;&#58;nHeight &#41; + 1&#41; &#46;OR&#46; &#58;&#58;sx <> &#40;INT&#40; &#40;y-&#58;&#58;nStartCols &#41;/&#58;&#58;nHeight &#41; + 1 &#41; &#58;&#58;sx &#58;= INT&#40;&#40;x-&#58;&#58;nStartRow&#41;/&#58;&#58;nHeight &#41; + 1 &#58;&#58;sy &#58;= INT&#40;&#40;y -&#58;&#58;nStartCols &#41;/&#58;&#58;nWidth &#41; IF x < &#58;&#58;nStartRow &#58;&#58;sx &#58;= 0 x &#58;= 0 ENDIF &#58;&#58;sxTemp &#58;= &#58;&#58;nStartRow + &#58;&#58;sx * &#58;&#58;nHeight &#58;&#58;syTemp &#58;= &#58;&#58;nStartCols + &#58;&#58;sy * &#58;&#58;nWidth + &#58;&#58;nWidth &#58;&#58;oWnd&#58;refresh&#40;&#41; ENDIF return nil //-----------------------------------------------------------------// METHOD End&#40;&#41; RELEASE FONT &#58;&#58;planFont &#58;&#58;hBru&#58;end&#40;&#41; &#58;&#58;hPen&#58;end&#40;&#41; &#58;&#58;hPen1&#58;end&#40;&#41; &#58;&#58;hPen3&#58;end&#40;&#41; 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&#58;//www&#46;atzwanger&#46;com/fw/pickdateclass&#46;jpg[/img:1nmn1116]
Calendario anual
Gracias Otto, Antonio, Manuel. Ya la tengo en uso:[url=http&#58;//img368&#46;imageshack&#46;us/my&#46;php?image=asistenciamu5&#46;jpg:1lgvfz7m][img:1lgvfz7m]http&#58;//img368&#46;imageshack&#46;us/img368/5341/asistenciamu5&#46;th&#46;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&#46;ch" MemVar nClrM // Color principal usado en toda la aplicación // por definición GetSysColor&#40;2&#41; 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&#40; nTop, nLeft, nWidth, nHeight, oWnd, nYear, nClrFore, nClrBack &#41; METHOD Redefine&#40; nId, oWnd &#41; METHOD Paint&#40;&#41; METHOD Display&#40;&#41; INLINE &#58;&#58;BeginPaint&#40;&#41;, &#58;&#58;Paint&#40;&#41;, &#58;&#58;EndPaint&#40;&#41;, 0 METHOD Destroy&#40;&#41; METHOD LButtonDown&#40; nRow, nCol, nKeyFlags &#41; METHOD LButtonUp&#40; nRow, nCol, nKeyFlags &#41; METHOD PreviousYear&#40;&#41; INLINE &#58;&#58;nYear--, &#58;&#58;Refresh&#40;&#41; METHOD NextYear&#40;&#41; INLINE &#58;&#58;nYear++, &#58;&#58;Refresh&#40;&#41; METHOD EraseBkGnd&#40; hDC &#41; INLINE 0 METHOD MouseMove&#40; nRow, nCol, nKeyFlags &#41; ENDCLASS //----------------------------------------------------------------------------// METHOD New&#40; nTop, nLeft, nWidth, nHeight, oWnd, nYear, nClrFore, nClrBack &#41; CLASS TPickDate DEFAULT nWidth &#58;= 800,; nHeight &#58;= 300,; nLeft &#58;= 0,; nTop &#58;= 0,; nYear &#58;= Year&#40; Date&#40;&#41; &#41;, ; oWnd &#58;= GetWndDefault&#40;&#41;,; nClrm &#58;= GetSysColor&#40; 2 &#41; &#58;&#58;lMove = &#46;F&#46; &#58;&#58;nTopStart = 0 // for header &#58;&#58;nLeftStart = 75 // col header &#58;&#58;nTop = nTop &#58;&#58;nLeft = nLeft &#58;&#58;nBottom = nTop + nHeight - 1 &#58;&#58;nRight = nLeft + nWidth - 1 &#58;&#58;nYear = Year&#40; Date&#40;&#41; &#41; &#58;&#58;oWnd = oWnd &#58;&#58;aFIng = &#123;&#125; // arreglos de días especiales &#58;&#58;aFBaj = &#123;&#125; &#58;&#58;aDVac = &#123;&#125; &#58;&#58;aDFal = &#123;&#125; &#58;&#58;aDInc = &#123;&#125; &#58;&#58;aDFes = &#123;&#125; &#58;&#58;aDSan = &#123;&#125; &#58;&#58;aDNLb = &#123;&#125; &#58;&#58;dStart &#58;= &#58;&#58;dEnd &#58;= &#58;&#58;dTemp &#58;= Date&#40;&#41; &#58;&#58;nClrText = nClrFore &#58;&#58;nClrPane = nClrBack &#58;&#58;nStyle = nOr&#40; WS_CHILD, WS_VISIBLE, WS_TABSTOP, WS_BORDER &#41; DEFINE BRUSH &#58;&#58;oBrushSunday COLOR LightColor&#40;240,nClrM&#41; // Sundays column green brush DEFINE BRUSH &#58;&#58;oBrushSelected COLOR nRGB&#40; 240, 232, 188 &#41; // Selected days orange brush DEFINE FONT &#58;&#58;oFont NAME "MS Sans Serif" SIZE 0, -10 BOLD DEFINE FONT &#58;&#58;oFontHeader NAME "MS Sans Serif" SIZE 0, -10 #ifdef __XPP__ DEFAULT &#58;&#58;lRegistered &#58;= &#46;F&#46; #endif &#58;&#58;Register&#40;&#41; if ! Empty&#40; oWnd&#58;hWnd &#41; &#58;&#58;Create&#40;&#41; oWnd&#58;AddControl&#40; Self &#41; else oWnd&#58;DefControl&#40; Self &#41; endif return self //----------------------------------------------------------------------------// METHOD Redefine&#40; nId, oWnd &#41; CLASS TPickDate DEFAULT oWnd &#58;= GetWndDefault&#40;&#41;, ; nClrm&#58;= GetSysColor&#40; 2 &#41; &#58;&#58;nId = nId &#58;&#58;oWnd = oWnd &#58;&#58;lMove = &#46;F&#46; &#58;&#58;nTopStart = 0 // for header &#58;&#58;nLeftStart = 75 // col header &#58;&#58;dStart &#58;= &#58;&#58;dEnd &#58;= &#58;&#58;dTemp &#58;= Date&#40;&#41; &#58;&#58;nYear = Year&#40; Date&#40;&#41; &#41; &#58;&#58;aFIng = &#123;&#125; // arreglos de días especiales &#58;&#58;aFBaj = &#123;&#125; &#58;&#58;aDVac = &#123;&#125; &#58;&#58;aDFal = &#123;&#125; &#58;&#58;aDInc = &#123;&#125; &#58;&#58;aDFes = &#123;&#125; &#58;&#58;aDSan = &#123;&#125; &#58;&#58;aDNLb = &#123;&#125; DEFINE BRUSH &#58;&#58;oBrushSunday COLOR LightColor&#40;240,nClrM&#41; // nRGB&#40; 183, 249, 185 &#41; // Sundays column green brush DEFINE BRUSH &#58;&#58;oBrushSelected COLOR nRGB&#40; 240, 232, 188 &#41; // Selected days orange brush DEFINE FONT &#58;&#58;oFont NAME "MS Sans Serif" SIZE 0, -10 BOLD DEFINE FONT &#58;&#58;oFontHeader NAME "MS Sans Serif" SIZE 0, -10 &#58;&#58;SetColor&#40; 0, 0 &#41; &#58;&#58;Register&#40;&#41; oWnd&#58;DefControl&#40; Self &#41; return Self //----------------------------------------------------------------------------// METHOD Paint&#40;&#41; CLASS TPickDate local aInfo &#58;= &#58;&#58;DispBegin&#40;&#41; local hDC &#58;= &#58;&#58;hDC, cDay, nDay, n, dDate, nColStep, nRowStep local dTmpDate, nMonth &#58;= 0, nLeftCol &#58;= 0 local nColor, cDate // para evaluar días especiales local lBrush, nBrush, oBrush FillRect&#40; hDC, GetClientRect&#40; &#58;&#58;hWnd &#41;, &#58;&#58;oBrush&#58;hBrush &#41; nRowStep = &#40; &#40;&#58;&#58;nHeight-3&#41; - &#58;&#58;nTopStart &#41; / 13 // Uso de Gradient&#40;&#41; en vez de GradientFill&#40;&#41; Gradient&#40; &#58;&#58;hDC, &#123; 0, 0, &#58;&#58;nHeight, &#58;&#58;nWidth &#125;, LightColor&#40;250,nClrM&#41;, LightColor&#40;200,nClrM&#41;, &#46;T&#46; &#41; dDate = CToD&#40; "01/01/" + Str&#40; &#58;&#58;nYear, 4 &#41; &#41; dDate += 8 - DoW&#40; dDate &#41; nColStep = &#40; &#58;&#58;nWidth - &#58;&#58;nLeftStart - 3 &#41; / 37 Gradient&#40; &#58;&#58;hDC, &#123; 0, 0, nRowStep - 1, &#58;&#58;nWidth &#125;, LightColor&#40;225,nClrM&#41;, LightColor&#40;175,nClrM&#41;, &#46;T&#46; &#41; &#58;&#58;Say&#40; &#40; &#58;&#58;nTopStart + &#40; nRowStep / 2 &#41; - &#40; &#58;&#58;oFont&#58;nHeight / 2 &#41;&#41;,; &#40; &#40; &#58;&#58;nLeftStart + nColStep &#41; / 2 &#41; - &#40; GetTextWidth&#40; hDC, Str&#40; &#58;&#58;nYear, 4 &#41;, &#58;&#58;oFont&#58;hFont &#41; / 2 &#41;,; Str&#40; &#58;&#58;nYear, 4 &#41;,,, &#58;&#58;oFont, &#46;T&#46;, &#46;T&#46; &#41; // Paint Sunday background color for n = 1 to 36 step 7 FillRect&#40; hDC, &#123; 0, &#58;&#58;nLeftStart + &#40; nColStep * n &#41;,; &#58;&#58;nHeight - 1, &#58;&#58;nLeftStart + &#40; nColStep * &#40; n + 1 &#41; &#41; &#125;, &#58;&#58;oBrushSunday&#58;hBrush &#41; next for nMonth = 1 to 12 &#58;&#58;Line&#40; &#58;&#58;nTopStart + nMonth * nRowStep, 0,&#40;&#58;&#58;nTopStart + nMonth * nRowStep&#41;, &#58;&#58;nWidth - 1 &#41; &#58;&#58;Say&#40; &#58;&#58;nTopStart + nMonth * nRowStep + &#40; nRowStep / 2 &#41; - &#40; &#58;&#58;oFont&#58;nHeight / 2 &#41;, 3, cMonth&#40; RegionDate&#40;nMonth, Str&#40; Year&#40; Date&#40;&#41; &#41;, 4 &#41;&#41;&#41; ,,, &#58;&#58;oFont, &#46;T&#46;, &#46;T&#46; &#41; next // fill selected days if &#58;&#58;lMove dTmpDate = Min&#40; &#58;&#58;dStart, &#58;&#58;dEnd &#41; while dTmpDate <= Max&#40; &#58;&#58;dStart, &#58;&#58;dEnd &#41; nMonth = Month&#40; dTmpDate &#41; nLeftCol = &#58;&#58;nLeftStart + &#40; nColStep * &#40; DOW&#40; RegionDate&#40; nMonth, Str&#40; &#58;&#58;nYear, 4 &#41; &#41; &#41; &#41; &#41; + ; nColStep * &#40; Day&#40; dTmpDate &#41; - 1 &#41; FillRect&#40; hDC, &#123; &#58;&#58;nTopStart + month&#40;dTmpDate&#41; * nRowStep + 1,; nLeftCol, &#58;&#58;nTopStart + Month&#40; dTmpDate &#41; * nRowStep + nRowStep,; nLeftCol + nColStep&#125;, &#58;&#58;oBrushSelected&#58;hBrush &#41; dTmpDate++ end endif // Draw days for n = 1 to 36 &#58;&#58;Line&#40; 0, &#58;&#58;nLeftStart + &#40; nColStep * n &#41;, &#58;&#58;nHeight - 1, &#58;&#58;nLeftStart + &#40; nColStep * n &#41; &#41; nColor &#58;= if&#40; DoW&#40; dDate &#41; ==1, CLR_RED, 0 &#41; cDay = SubStr&#40; CDoW&#40; dDate++ &#41;, 1, 1 &#41; &#58;&#58;Say&#40; &#40; &#58;&#58;nTopStart + nRowStep * 0&#46;4 &#41;-2,; &#58;&#58;nLeftStart + &#40; nColStep * n &#41; + &#40; nColStep / 2 &#41; - &#40; GetTextWidth&#40; hDC, cDay, &#58;&#58;oFont&#58;hFont &#41; / 2 &#41; + 1,; cDay, nColor, 0, &#58;&#58;oFont, &#46;T&#46;, &#46;T&#46; &#41; next // Draw months for nMonth = 1 to 12 dDate = RegionDate&#40;nMonth,Str&#40; &#58;&#58;nYear, 4 &#41; &#41; nDay = DoW&#40; dDate &#41; while Month&#40; dDate &#41; == nMonth cDay = AllTrim&#40; Str&#40; Day&#40; dDate &#41; &#41; &#41; nColor &#58;= 0 lBrush &#58;=&#46;F&#46; cDate &#58;= DtoS&#40; dDate&#41; do case // identifica el día y define el pintado case DoW&#40; dDate &#41; == 1; nColor &#58;= CLR_RED case AScan&#40; &#58;&#58;aFIng, cDate &#41; <> 0; nColor &#58;= CLR_WHITE ; lBrush &#58;= &#46;T&#46;; nBrush &#58;= 2 case AScan&#40; &#58;&#58;aFBaj, cDate &#41; <> 0; nColor &#58;= CLR_WHITE ; lBrush &#58;= &#46;T&#46;; nBrush &#58;= 3 case AScan&#40; &#58;&#58;aDFal, cDate &#41; <> 0; nColor &#58;= CLR_HRED ; lBrush &#58;= &#46;T&#46;; nBrush &#58;= 4 case AScan&#40; &#58;&#58;aDInc, cDate &#41; <> 0; nColor &#58;= CLR_YELLOW ; lBrush &#58;= &#46;T&#46;; nBrush &#58;= 4 case AScan&#40; &#58;&#58;aDVac, cDate &#41; <> 0; nColor &#58;= CLR_BLUE ; lBrush &#58;= &#46;T&#46;; nBrush &#58;= 5 case AScan&#40; &#58;&#58;aDNLb, cDate &#41; <> 0; nColor &#58;= CLR_HRED ; lBrush &#58;= &#46;T&#46;; nBrush &#58;= 1 case AScan&#40; &#58;&#58;aDFes, cDate &#41; <> 0; nColor &#58;= CLR_HGREEN ; lBrush &#58;= &#46;T&#46;; nBrush &#58;= 1 case AScan&#40; &#58;&#58;aDSan, cDate &#41; <> 0; nColor &#58;= CLR_HGREEN ; lBrush &#58;= &#46;T&#46;; nBrush &#58;= 1 endcase if lBrush nMonth = Month&#40; dDate &#41; nLeftCol = &#58;&#58;nLeftStart + &#40; nColStep * &#40; DOW&#40; RegionDate&#40; nMonth, Str&#40; &#58;&#58;nYear, 4 &#41; &#41; &#41; &#41; &#41; + ; nColStep * &#40; Day&#40; dDate &#41; - 1 &#41; do case case nBrush == 1 ; DEFINE BRUSH oBrush COLOR LightColor&#40;240,nClrM&#41; 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&#40; hDC, &#123; &#58;&#58;nTopStart + month&#40;dDate&#41; * nRowStep + 1,; nLeftCol + 1, &#58;&#58;nTopStart + Month&#40; dDate &#41; * nRowStep + nRowStep,; nLeftCol + nColStep&#125;, oBrush&#58;hBrush &#41; oBrush&#58;End&#40;&#41; endif &#58;&#58;Say&#40; &#40; &#58;&#58;nTopStart + nMonth * nRowStep + &#40; nRowStep * 0&#46;4 &#41; &#41;-2,; &#58;&#58;nLeftStart + &#40; nColStep * nDay++ &#41; + &#40; nColStep / 2 &#41; - &#40; GetTextWidth&#40; hDC, cDay, &#58;&#58;oFont&#58;hFont &#41; / 2 &#41; + 1,; cDay, nColor, 0, &#58;&#58;oFontHeader, &#46;T&#46;, &#46;T&#46; &#41; dDate++ end next if ValType&#40; &#58;&#58;bPainted &#41; == "B" Eval&#40; &#58;&#58;bPainted, hDC, Min&#40; &#58;&#58;dStart, &#58;&#58;dEnd &#41;, Max&#40; &#58;&#58;dStart, &#58;&#58;dEnd &#41;, Self &#41; endif &#58;&#58;DispEnd&#40; aInfo &#41; return 0 //----------------------------------------------------------------------------// METHOD Destroy&#40;&#41; CLASS TPickDate &#58;&#58;oBrushSunday&#58;End&#40;&#41; &#58;&#58;oBrushSelected&#58;End&#40;&#41; &#58;&#58;oFontHeader&#58;End&#40;&#41; return Super&#58;Destroy&#40;&#41; //----------------------------------------------------------------------------// METHOD LButtonDown&#40; nRow, nCol, nKeyFlags &#41; CLASS TPickDate local nMonth &#58;= Int&#40; &#40; nRow - &#58;&#58;nTopStart &#41; / &#40; &#40; &#58;&#58;nHeight - &#58;&#58;nTopStart &#41; / 13 &#41; &#41; local nDay &#58;= Int&#40; &#40; nCol - &#58;&#58;nLeftStart &#41; / &#40; &#40; &#58;&#58;nWidth - &#58;&#58;nLeftStart &#41; / 37 &#41; &#41; - ; DoW&#40; RegionDate&#40; nMonth, Str&#40; &#58;&#58;nYear, 4 &#41; &#41; &#41; + 1 if nDay > 0 &#46;and&#46; nMonth > 0 // to work with valid dates only &#58;&#58;dStart &#58;= CToD&#40; AllTrim&#40; AllTrim&#40; Str&#40; nDay &#41; &#41;+ "/" + Str&#40; nMonth &#41; &#41; + "/" + Str&#40; &#58;&#58;nYear, 4 &#41; &#41; &#58;&#58;lMove &#58;= &#46;T&#46; &#58;&#58;Refresh&#40; &#46;F&#46; &#41; endif return Super&#58;LButtonDown&#40; nRow, nCol, nKeyFlags &#41; //-----------------------------------------------------------------// METHOD LButtonUp&#40; nRow, nCol, nKeyFlags &#41; CLASS TPickDate if ValType&#40; &#58;&#58;bSelect &#41; == "B" Eval&#40; &#58;&#58;bSelect, Min&#40; &#58;&#58;dStart, &#58;&#58;dEnd &#41;, Max&#40; &#58;&#58;dStart, &#58;&#58;dEnd &#41;, Self &#41; endif &#58;&#58;lMove &#58;= &#46;F&#46; return Super&#58;LButtonUp&#40; nRow, nCol, nKeyFlags &#41; //-----------------------------------------------------------------// METHOD MouseMove&#40; nRow, nCol, nKeyFlags &#41; CLASS TPickDate local nMonth &#58;= Int&#40; &#40; nRow - &#58;&#58;nTopStart &#41; / &#40; &#40; &#58;&#58;nHeight - &#58;&#58;nTopStart &#41; / 13 &#41; &#41; local nDay &#58;= Int&#40; &#40; nCol - &#58;&#58;nLeftStart &#41; / &#40; &#40; &#58;&#58;nWidth - &#58;&#58;nLeftStart &#41; / 37 &#41; &#41; - ; DoW&#40; RegionDate&#40; nMonth, Str&#40; &#58;&#58;nYear, 4 &#41; &#41; &#41; + 1 local dEnd if nDay > 0 &#46;and&#46; nMonth > 0 // to work with valid dates only dEnd = CToD&#40; AllTrim&#40; Str&#40; nDay &#41; &#41; + "/" + AllTrim&#40; Str&#40; nMonth &#41; &#41; + "/" + Str&#40; &#58;&#58;nYear, 4 &#41; &#41; if ! Empty&#40; dEnd &#41; &#46;and&#46; dEnd != &#58;&#58;dTemp // for reducing continuous refreshes &#58;&#58;dTemp &#58;= dEnd &#58;&#58;dEnd = dEnd &#58;&#58;Refresh&#40; &#46;F&#46; &#41; if ValType&#40; &#58;&#58;bChange &#41; == "B" Eval&#40; &#58;&#58;bChange, Min&#40; &#58;&#58;dStart, &#58;&#58;dEnd &#41;, Max&#40; &#58;&#58;dStart, &#58;&#58;dEnd &#41;, Self &#41; endif endif endif return Super&#58;MouseMove&#40; nRow, nCol, nKeyFlags &#41; //-----------------------------------------------------------------// function RegionDate&#40; nMonth, cYear &#41; return CToD&#40; "01/" + AllTrim&#40; Str&#40; nMonth &#41; &#41; + "/" + cYear &#41; //-----------------------------------------------------------------// // LightColor&#40;nDegrade,nColor&#41; para degradar o seleccionar color #pragma BEGINDUMP #include <Windows&#46;h> HARBOUR HB_FUN_LIGHTCOLOR&#40; &#41; &#123; COLORREF lColor = hb_parnl&#40;2&#41;; LONG lScale = hb_parni&#40;1&#41;; long R = MulDiv&#40;255-GetRValue&#40;lColor&#41;,lScale,255&#41;+GetRValue&#40;lColor&#41;; long G = MulDiv&#40;255-GetGValue&#40;lColor&#41;,lScale,255&#41;+GetGValue&#40;lColor&#41;; long B = MulDiv&#40;255-GetBValue&#40;lColor&#41;,lScale,255&#41;+GetBValue&#40;lColor&#41;; hb_retnl&#40; RGB&#40;R, G, B&#41; &#41;; &#125; #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&#40; nYear &#41; Local a, b, c, Aa, Bb a &#58;= nYear % 19 b &#58;= nYear % 4 c &#58;= nYear % 7 Aa &#58;= &#40; &#40; 19 * a &#41; + 24 &#41; % 30 Bb &#58;= &#40; &#40; 2 * b &#41; + &#40; 4 * c &#41; + &#40; 6 * Aa &#41; + 5 &#41; % 7 Return StoD&#40; LTrim&#40; Str&#40; nYear &#41; &#41; + "03" + StrZero&#40; Aa, 2 &#41; &#41; + 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&#58;//es&#46;wikipedia&#46;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&#40; nYear &#41; Local a, b, c, Aa, Bb, n n &#58;= If&#40; nYear > 2099, 6, If&#40; nYear > 2199, 0, 5 &#41; &#41; a &#58;= nYear % 19 b &#58;= nYear % 4 c &#58;= nYear % 7 Aa &#58;= &#40; &#40; 19 * a &#41; + 24 &#41; % 30 Bb &#58;= &#40; &#40; 2 * b &#41; + &#40; 4 * c &#41; + &#40; 6 * Aa &#41; + n &#41; % 7 Return StoD&#40; LTrim&#40; Str&#40; nYear &#41; &#41; + "03" + StrZero&#40; Aa, 2 &#41; &#41; + Bb + 22 - 2[/code:3aum09jk]Un abrazo.Manuel Mercado
Calendario anual
[code:rs7cwyqv]Function dHollyFriday&#40; nYear &#41; Local a, b, c, Aa, Bb, n n &#58;= If&#40; nYear > 2099, 6, If&#40; nYear > 2199, 0, 5 &#41; &#41; a &#58;= nYear % 19 b &#58;= nYear % 4 c &#58;= nYear % 7 Aa &#58;= &#40; &#40; 19 * a &#41; + 24 &#41; % 30 Bb &#58;= &#40; &#40; 2 * b &#41; + &#40; 4 * c &#41; + &#40; 6 * Aa &#41; + n &#41; % 7 Return StoD&#40; LTrim&#40; Str&#40; nYear &#41; &#41; + "03" + StrZero&#40; Aa, 2 &#41; &#41; + 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&#40; nYear &#41; Local a, b, c, Aa, Bb, m, n m &#58;= If&#40; nYear > 2199, 25, 24 &#41; n &#58;= If&#40; nYear > 2099, 6, If&#40; nYear > 2199, 0, 5 &#41; &#41; a &#58;= nYear % 19 b &#58;= nYear % 4 c &#58;= nYear % 7 Aa &#58;= &#40; &#40; 19 * a &#41; + m &#41; % 30 Bb &#58;= &#40; &#40; 2 * b &#41; + &#40; 4 * c &#41; + &#40; 6 * Aa &#41; + n &#41; % 7 Return StoD&#40; LTrim&#40; Str&#40; nYear &#41; &#41; + "03" + StrZero&#40; Aa, 2 &#41; &#41; + Bb + 20 [/code:1uugg64y]Saudos.Manuel Mercado