Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Calendar style

From: allenk::powerup::com::au at: 20-Nov-2001 15:01

Hi Mario, Let me see if can understand what you are trying to do. I've worked from the following assumptions. 1. You build a list of acceptable dates marked with ovals, which you are doing by building a data block like date-data. 2. A user can only select one of the Oval dates? Any other crossed date is uncrossed 3. To save the state of the calendar, you will just save the contents of face/data. OK make the following changes. Find the line. f/parent-face/action none none none and change it too f/parent-face/action f/parent-face none none That just updates the code so we can use face inside the action block instead of having to using a word refering to the calendar (it did use c). Brings into line with current VID methods. Then replace the layout and example part of the script with this.. ;---Example ;dates and the display effects for those dates ; acceptable effects [cross bold italic underline oval 100.100.100] ; A PIM display could be created using this simple data struture date-data: reduce [ 13-11-2001 [oval cross] 2-11-2001 [oval] 10-11-2001 [oval] 23-12-2001 [oval] 2-12-2001 [oval] 4-12-2001 [oval] 1-12-2001 [oval] ] main-face: layout [ styles calendars calendar with [show-navbar?: true] [ if all [face/effect? face/date 'oval not face/effect? face/date 'cross] [ face/add-effect face/date 'cross foreach [date effects] face/data [ if (date <> face/date) [face/remove-effect date 'cross] ] ] ] data date-data ] ;-------------------------- So how does it work? Basically it adds and removes effects on dates in the data block based on the rules we have set. If the date clicked has the oval effect and isn't currently crossed, then we add the cross for the clicked date and remove the cross from any other date in the calendar's data block. Hope this helps. Cheers, Allen K