Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #12867
| From | "Urs Eggmann" <Urs.Eggmann@shinternet.ch> |
|---|---|
| Newsgroups | comp.lang.clipper.visual-objects |
| Subject | Re: calendar controll |
| Date | 2020-02-24 14:35 +0100 |
| Message-ID | <hbi1oqFq7e4U1@mid.individual.net> (permalink) |
| References | <49aaabb2-544a-4709-8705-94784696e717@googlegroups.com> <e39c2faa-ef48-46dd-a9f4-a3d05637363b@googlegroups.com> <hbdjhuFsapnU1@mid.individual.net> <a80fdbd7-8754-4e89-b4c5-56ae2a982022@googlegroups.com> |
Hi Aurora,
Please let me give a little tip for the conversation. It is easier to put a
answer on top of the new mail. Then the answer is more closed to
the question.
First question:
> I would like to color the text (day of the month) in red which corresponds
> to the Italian holiday.
and
> One of the public holidays is on 25/04 / but there are others (02/06)
> every year.
For that you must know the rule for that day. For example "third tuesday of
April" Next you need to put that in a function "FUNCTION
FindTheWantedDay(Year as INT) as USUAl"
Similar to the function OsterSonntag(...) in the module
ccCalendar-Funktionen. Now you can take the method "METHOD
Actualize(dTarget) CLASS ccCalendar" to use that date further. Quite a bit
of work.
Next question:
> The day of the month which corresponds to Saturday first of all.
Please replace the method "METHOD DrawDays( hDC , dDatum ) CLASS ccCalendar"
with the following:
At the end of the method you can see the principle. All Saturdays are shown
in a different color. (Keep attention on line breaks caused by the mail
program!)
******************************************************
METHOD DrawDays( hDC , dDatum ) CLASS ccCalendar // Metodo con sabato
colorato
LOCAL nDays, nCol, nRow , nColBegin ,i AS INT
* LOCAL nIndex AS INT
LOCAL rect IS _WINRECT
LOCAL dDateForWeekCalc, dDate AS DATE
* nBeginn := timeGetTime() // Für Zeitmessungen während der Entwicklung
SetBkMode(hDC, TRANSPARENT) // Sonst stehen die Tage auf kleinen weissen
Rechteckchen...
SelectObject(hDC , SELF:oFont_actual:Handle() )
SELF:aDays := {} // Array mit Tag, Column, Row und Index für die grafischen
Spielereien
// Erster Tag des Monats
SELF:dFirst := ConDate(Year(dDatum),Month(dDatum),1 )
dDate := SELF:dFirst - 1 // Startdate für das Array aDays
// Letzter Tag des Monats
SELF:dLast := SELF:LastDayofMonth(dDatum)
dDateForWeekCalc := SELF:dFirst // Datum zur Berechnung der Woche.
// Anzahl Tage im Monat
nDays := SELF:dLast - SELF:dFirst+1
// In welcher Kolonne (== Wochentag) startet die Tabelle?
nColBegin := nCol := DoWGer(SELF:dFirst ) // Montag als erster Tag der Woche
(VO hat den Sonntag....)
// Die Reihe ist immer die erste
nRow := 1
FOR i := 1 TO nDays
// Rechteck für die Woche des Monats
// Wird mehrfach gerechnet, wäre noch zu verbessern
rect.left :=0
rect.top := 35 + nRow * SELF:nHoeheRechteck
rect.right := rect.left+SELF:nBreiteRechteck
rect.bottom := rect.top +SELF:nHoeheRechteck - 2 // minus 2, sonst ist das
Grid weg....
SetTextColor(hDC, RGB(0,0,255))
// Draw the number of week
DrawText(hDC,String2Psz(Str( WeekFeser( dDateForWeekCalc ) ,2,0) )
,2,@rect,DT_CENTER+DT_VCENTER+DT_SINGLELINE)
// Set the rect for the text
rect.left :=nCol * SELF:nBreiteRechteck
rect.top := 35 + nRow * SELF:nHoeheRechteck
rect.right := rect.left + SELF:nBreiteRechteck
rect.bottom := rect.top+SELF:nHoeheRechteck
// Draw the text
SetTextColor(hDC, RGB(0,0,0))
DrawText(hDC,String2Psz(Str(i,2,0) ),2,@rect,DT_CENTER+DT_VCENTER+DT_SINGLELINE)
// nIndex := ( nRow - 1) * 7 + nCol
AAdd (SELF:aDays , { i , nCol , nRow, ( nRow - 1) * 7 + nCol , dDate + i } )
// "Universal-Array für Tage, Spalten, Reihen und Datums des Monats
* ? i , " " , nCol , " " , nRow , " " , ( nRow - 1) * 7 + nCol
// Quando è sabato ... // Wenn es Sonntag ist....
* IF Mod( nCol , 6 ) == 0
IF nCol == 6
SetTextColor(hDC, RGB(0,200,200))
rect.left := nCol * SELF:nBreiteRechteck
rect.top := 35 + nRow * SELF:nHoeheRechteck
rect.right := rect.left + SELF:nBreiteRechteck
rect.bottom := rect.top + SELF:nHoeheRechteck
DrawText(hDC,String2Psz(Str(i,2,0) ),2,@rect,DT_CENTER+DT_VCENTER+DT_SINGLELINE)
SetTextColor(hDC, RGB(0,0,0))
ELSEIF nCol == 7 // Quando è domenica ... // Wenn es Sonntag ist....
SetTextColor(hDC, RGB(255,0,0))
rect.left := nCol * SELF:nBreiteRechteck
rect.top := 35 + nRow * SELF:nHoeheRechteck
rect.right := rect.left + SELF:nBreiteRechteck
rect.bottom := rect.top + SELF:nHoeheRechteck
DrawText(hDC,String2Psz(Str(i,2,0) ),2,@rect,DT_CENTER+DT_VCENTER+DT_SINGLELINE)
SetTextColor(hDC, RGB(0,0,0))
nCol := 0 // Reset nCol
nRow ++
dDateForWeekCalc += 7
ENDIF
nCol ++ //
NEXT i
IF Between(Today() , SELF:dFirst , SELF:dLast)
SELF:FrameCell(Today(),hDC )
ENDIF
* ShowArray(SELF:aDays)
* nEnde := timeGetTime()
* ? nDauer := nEnde - nBeginn , ' milliSec'
RETURN NIL
******************************************************
regards
Urs
Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
calendar controll aurorabaccio@gmail.com - 2020-02-16 02:09 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-02-16 21:30 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-02-17 07:27 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-02-17 23:31 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-02-18 06:04 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-02-18 16:34 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-02-18 08:19 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-02-19 21:28 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-02-19 22:46 -0800
Re: calendar controll aurorabaccio@gmail.com - 2020-02-19 23:02 -0800
Re: calendar controll aurorabaccio@gmail.com - 2020-02-20 04:59 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-02-22 22:07 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-02-20 05:30 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-02-22 22:06 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-02-23 05:06 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-02-24 14:35 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-02-27 05:12 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-02-27 20:46 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-02-29 06:54 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-02-29 16:45 +0100
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-03-01 20:41 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-03-02 05:50 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-03-02 19:19 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-03-03 05:42 -0800
Re: calendar controll aurorabaccio@gmail.com - 2020-03-03 05:52 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-03-03 23:20 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-03-03 07:33 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-03-03 23:01 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-03-04 07:22 -0800
Re: calendar controll aurorabaccio@gmail.com - 2020-03-06 05:32 -0800
Re: calendar controll aurorabaccio@gmail.com - 2020-03-06 05:48 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-03-06 22:14 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-03-06 05:54 -0800
Re: calendar controll aurorabaccio@gmail.com - 2020-03-06 23:44 -0800
Re: calendar controll aurorabaccio@gmail.com - 2020-03-07 06:04 -0800
Re: calendar controll "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2020-03-07 15:54 +0100
Re: calendar controll aurorabaccio@gmail.com - 2020-03-07 07:37 -0800
csiph-web