[REBOL] Calendar style
From: mario:cassani:icl at: 19-Nov-2001 12:34
Hi all,
during the making of a GUI I needed a calendar style for
my layout so I used Allen's nice calendar.r code.
My code seeks for some daily index putting an oval around
the days when the index is found.
Later the GUI is shown and, when I click on a day it is
highlighted
with a cross and the date is stored. Doing
this the cross is removed from the previuosly clicked day
(if any).
The problem is that all the days with an oval are crossed
by the click!
I'm not a /View GUY ;P so I need some help to understand
if it's wrong the way I use calendar/add-effect or if the
calendar.r script is somehow buggy...
Thank you for any help/suggestion
Mario
Snipplets of my code follow (watch line wraps):
8<----------------------------------------------------------
; *** Open Calendar Style
; ========================
do %calendar.r ; Can be found on Rebolforces Rebsite
; *** The index seeking function (simplified, no cycles to look for the
index)
;
============================================================================
index-seek: func [
todopath-base
index-date
] [
index-year-end: index-date/year
index-month-end: index-date/month
index-day-end: index-date/day
if exists? index-path: join todopath-base ["/" index-year "/"
index-month "/" index-day "/index-todo.txt"] [
append date-data to-date rejoin [index-year "-" index-month "-"
index-day]
append/only date-data [oval]
]
]
; *** MAIN ***
; ************************
; todopath-base and index-date are initialised
; ************************
index-seek todopath-base index-date
; ************************
; In the main layout the following code appears
; ************************
styles calendars
c: calendar with [show-navbar?: true] [
if c/effect? current-index-date 'cross [
c/remove-effect current-index-date 'cross
]
; ************************
; do something changing 'current-index-date
; ************************
c/add-effect current-index-date 'cross
] date current-index-date data date-data
8<----------------------------------------------------------