Problems embedding ILCalendar

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems embedding ILCalendar

Freddy-2
I noted how the the ILCalendar is  supposed to work from Nico Petton's
latest blog post, Flow control in Iliad (a great article, BTW):

http://smalltalk.gnu.org/blog/nico/control-flow-iliad

ILCalendar is called via the 'show:onAnswer:' message, just like
Seaside's 'call:' message.  After I try to embed the ILCalendar
widget, though, by doing:

MyWidget>>contents
    ^[:e |
       ...
       e build: ILCalendar new
       ...
      ]

I notice that while the calendar appears on the web page, when I try
to select a new month (by picking a different month and hitting the
select button), the calendar does not update to the new monthly
calendar, like it is supposed to when it is called from
'show:onAnswer:'.

Isn't the ILCalendar supposed to be embeddable as well as callable?
Or am I doing something wrong?
Reply | Threaded
Open this post in threaded view
|

Re: Problems embedding ILCalendar

Nicolas Petton
Hi,

The calendar is by default supposed to be showed, but you can embed it
easily.

To do so you can change the action with #actionBlock:

Another important thing : to maintain state you should make sure that
your calendar will persist trough requests. The easiest way to do so it
to add it as an instance variable:

Iliad.ILWidget subclass: MyWidget [
    | calendar |

    calendar [
        ^calendar ifNil: [
            caldendar := Iliad.ILCalendar new
                actionBlock: [:date | self selectDate: date];
                yourself]
    ]

    contents [
    ^[:e |
       ...
       e build: self calendar]
    ]
]

Cheers!

Nico

signature.asc (204 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problems embedding ILCalendar

Freddy-2
Thanks for the explanation below.  I actually have another problem
with the ILCalendarWidget.  I implemented in Pharo the code from:

http://smalltalk.gnu.org/blog/nico/control-flow-iliad

to see how it would work.

When I start up the SequenceApplication, by setting my browser to
http://localhost:7777/sequence, I notice that the calendar appears.
But  then I do the same thing I described earlier:  I select a new
month and hit the 'Select' button. Instead of updating the calendar to
the new month, though, the web page just hangs.  When I interrupt the
web page, and then try to reload the the same URL I get the message:

------------------------------------------
Internal Error

Error: subscript is out of bounds: 13

subscript is out of bounds: 13

Array(Object)>>errorSubscriptBounds:
Array(Object)>>at:
Month class>>daysInMonth:forYear:
DateAndTime
class>>year:month:day:hour:minute:second:nanoSecond:offset:
DateAndTime class>>year:month:day:hour:minute:second:offset:
DateAndTime class>>year:month:day:hour:minute:second:
DateAndTime class>>year:month:day:hour:minute:
DateAndTime class>>year:month:day:
Date class>>year:month:day:
Date class>>newDay:month:year:
[] in ILCalendar>>calendarTableContents
BlockClosure>>buildOn:
ILDivElement(ILElement)>>build:
[] in ILCalendar>>contents
BlockClosure>>buildOn:
------------------------------------------

I don't seem to be able to get the ILCalendarWidget to update to a new
month, as shown on http://dl.dropbox.com/u/1127795/sequence.gif.

I haven't tried out the code in GST, so I don't know if it's the Pharo
environment,



On 1 mar, 02:23, Nicolas Petton <[hidden email]> wrote:

> Hi,
>
> The calendar is by default supposed to be showed, but you can embed it
> easily.
>
> To do so you can change the action with #actionBlock:
>
> Another important thing : to maintain state you should make sure that
> your calendar will persist trough requests. The easiest way to do so it
> to add it as an instance variable:
>
> Iliad.ILWidget subclass: MyWidget [
>     | calendar |
>
>     calendar [
>         ^calendar ifNil: [
>             caldendar := Iliad.ILCalendar new
>                 actionBlock: [:date | self selectDate: date];
>                 yourself]
>     ]
>
>     contents [
>     ^[:e |
>        ...
>        e build: self calendar]
>     ]
> ]
>
> Cheers!
>
> Nico
>
>  signature.asc
> < 1 000AfficherTélécharger
Reply | Threaded
Open this post in threaded view
|

Re: Problems embedding ILCalendar

Nicolas Petton
Hi,

It seems to be a bug in the Pharo port. Could you report it on the bug
tracker?

http://code.google.com/p/iliadproject/issues/list

Thanks,

Nico

signature.asc (204 bytes) Download Attachment