Calendar Chooser

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

Calendar Chooser

Jon Hylands

Hi everyone,

So, I'm working on an application for managing my projects and timesheets and such, and one of the things I really wanted was a decent Calendar chooser. I looked around and didn't see one, so I spent a few hours and made what I think is a nice one...

Its a single morph class, with one support class. I've attached a screenshot. I have no idea how widgets like this are typically included - either as some kind of add-on, or included with the base image.

Thoughts?

- Jon





CalendarPicker.png (9K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Eliot Miranda-2


On Wed, Nov 2, 2011 at 11:15 AM, Jon Hylands <[hidden email]> wrote:

Hi everyone,

So, I'm working on an application for managing my projects and timesheets and such, and one of the things I really wanted was a decent Calendar chooser. I looked around and didn't see one, so I spent a few hours and made what I think is a nice one...

Its a single morph class, with one support class. I've attached a screenshot. I have no idea how widgets like this are typically included - either as some kind of add-on, or included with the base image.

Thoughts?

First thought is "cool"! 

I guess the trunk approach is to add it to MorphicExtras, e.g. in its own category.

BTW, I like the one on tripadvisor.com which allows you to scroll left and right through the months.  (Their implementation is buggy though; sometimes two months appear superimposed, and it doesn't look as nice as yours).


- Jon








--
best,
Eliot



Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Jon Hylands
Hey Eliot,

I had forgotten to add that before I took the picture, but its there now.

I guess the question I was asking is, how do I submit it? I can post a change set here, or a file out of the category, or whatever...

- Jon



On Wed, Nov 2, 2011 at 4:16 PM, Eliot Miranda <[hidden email]> wrote:


On Wed, Nov 2, 2011 at 11:15 AM, Jon Hylands <[hidden email]> wrote:

Hi everyone,

So, I'm working on an application for managing my projects and timesheets and such, and one of the things I really wanted was a decent Calendar chooser. I looked around and didn't see one, so I spent a few hours and made what I think is a nice one...

Its a single morph class, with one support class. I've attached a screenshot. I have no idea how widgets like this are typically included - either as some kind of add-on, or included with the base image.

Thoughts?

First thought is "cool"! 

I guess the trunk approach is to add it to MorphicExtras, e.g. in its own category.

BTW, I like the one on tripadvisor.com which allows you to scroll left and right through the months.  (Their implementation is buggy though; sometimes two months appear superimposed, and it doesn't look as nice as yours).


- Jon








--
best,
Eliot








CalendarPicker-2.png (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Eliot Miranda-2


On Wed, Nov 2, 2011 at 1:30 PM, Jon Hylands <[hidden email]> wrote:
Hey Eliot,

I had forgotten to add that before I took the picture, but its there now.

I guess the question I was asking is, how do I submit it? I can post a change set here, or a file out of the category, or whatever...

As I said I *think* the Squeak trunk way is to add it to MorphicExtras and save the Monticello package.  Alternatively, if its self-contained you could submit the change set and someone else will publish Monticvello.  But Monticello is great to ise so perhaps this is the time to learn it.

essentially:
Make sure your image is an updated trunk image (in Preferences set the update URL to http://source.squeak.org/trunk and update your image)
Make sure your widget/morph is in one of the MorphicExtras categories.
Open up a Monticello browser, and save the MorphicExtras package to inbox (general access)

Then someone with rights may move it from inbox to trunk.

Once you're confident using Monticello you can ask to have trunk update rights and side-step the intermediary.

HTH
Eliot


- Jon



On Wed, Nov 2, 2011 at 4:16 PM, Eliot Miranda <[hidden email]> wrote:


On Wed, Nov 2, 2011 at 11:15 AM, Jon Hylands <[hidden email]> wrote:

Hi everyone,

So, I'm working on an application for managing my projects and timesheets and such, and one of the things I really wanted was a decent Calendar chooser. I looked around and didn't see one, so I spent a few hours and made what I think is a nice one...

Its a single morph class, with one support class. I've attached a screenshot. I have no idea how widgets like this are typically included - either as some kind of add-on, or included with the base image.

Thoughts?

First thought is "cool"! 

I guess the trunk approach is to add it to MorphicExtras, e.g. in its own category.

BTW, I like the one on tripadvisor.com which allows you to scroll left and right through the months.  (Their implementation is buggy though; sometimes two months appear superimposed, and it doesn't look as nice as yours).


- Jon








--
best,
Eliot











--
best,
Eliot



Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Nicolas Cellier
In reply to this post by Jon Hylands
2011/11/2 Jon Hylands <[hidden email]>:
> Hey Eliot,
> I had forgotten to add that before I took the picture, but its there now.
> I guess the question I was asking is, how do I submit it? I can post a
> change set here, or a file out of the category, or whatever...
> - Jon
>

The preferred way is to save a Monticello package in
http://source.squeak.org/inbox
Classify your morph under MorphicExtras.
Check that your image does not contain superfluous changes in this
package (you can do this by attempting to merge with MorphicExtras
from http://source.squeak.org/trunk).
Then save your version of MorphicExtras in http://source.squeak.org/inbox

If it's too much to learn, just post a changeset here, someone will care.

Cheers

Nicolas

>
> On Wed, Nov 2, 2011 at 4:16 PM, Eliot Miranda <[hidden email]>
> wrote:
>>
>>
>> On Wed, Nov 2, 2011 at 11:15 AM, Jon Hylands <[hidden email]> wrote:
>>>
>>> Hi everyone,
>>> So, I'm working on an application for managing my projects and timesheets
>>> and such, and one of the things I really wanted was a decent Calendar
>>> chooser. I looked around and didn't see one, so I spent a few hours and made
>>> what I think is a nice one...
>>> Its a single morph class, with one support class. I've attached a
>>> screenshot. I have no idea how widgets like this are typically included -
>>> either as some kind of add-on, or included with the base image.
>>> Thoughts?
>>
>> First thought is "cool"!
>> I guess the trunk approach is to add it to MorphicExtras, e.g. in its own
>> category.
>> BTW, I like the one on tripadvisor.com which allows you to scroll left and
>> right through the months.  (Their implementation is buggy though; sometimes
>> two months appear superimposed, and it doesn't look as nice as yours).
>>>
>>> - Jon
>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> best,
>> Eliot
>>
>>
>>
>
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Sean P. DeNigris
Administrator
In reply to this post by Jon Hylands
Jon Hylands wrote
chooser. I looked around and didn't see one, so I spent a few hours and
made what I think is a nice one...
Wow, it looks really nice! You're releasing it under MIT?

Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Jon Hylands
Yes, of course - wouldn't make it into the image otherwise...

- Jon


On Wed, Nov 2, 2011 at 8:15 PM, Sean P. DeNigris <[hidden email]> wrote:

Jon Hylands wrote:
>
> chooser. I looked around and didn't see one, so I spent a few hours and
> made what I think is a nice one...
>

Wow, it looks really nice! You're releasing it under MIT?

Sean

--
View this message in context: http://forum.world.st/Calendar-Chooser-tp3980015p3983791.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.




Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Jon Hylands
Okay, I tried to update the base 4.2 image, and it ran into some issues that I don't have time to deal with right now, so I'm attaching a fileout of the code.

I wasn't sure if it was supposed to go into its own MorphicExtras category, or in one of the existing categories, so I just left it in its own for now.

Let me know if you have any issues with it...

Thanks,
Jon




On Wed, Nov 2, 2011 at 9:08 PM, Jon Hylands <[hidden email]> wrote:
Yes, of course - wouldn't make it into the image otherwise...

- Jon


On Wed, Nov 2, 2011 at 8:15 PM, Sean P. DeNigris <[hidden email]> wrote:

Jon Hylands wrote:
>
> chooser. I looked around and didn't see one, so I spent a few hours and
> made what I think is a nice one...
>

Wow, it looks really nice! You're releasing it under MIT?

Sean

--
View this message in context: http://forum.world.st/Calendar-Chooser-tp3980015p3983791.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.






MorphicExtras-CalendarChooser.st (20K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Sean P. DeNigris
Administrator
In reply to this post by Jon Hylands
Jon Hylands wrote
a decent Calendar
chooser... I spent a few hours and
made what I think is a nice one...
This thing is awesome!! Thanks a lot Jon for making it. It works great.

One question... how are you using it? I ask because the typical usage I've seen (e.g. in web forms) is that a calendar appears, you select a date, and it disappears, entering the date somewhere e.g. a text field. However, with your calendar, it looks like after a date is selected, the calendar remains. Presumably something would have to keep polling to see if a date was selected... Is that what you're doing?

Thanks again for the awesome gift :)

Cheers,
Sean
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Jon Hylands
Sean,

I'm using it in a timesheet tracking application. Basically, the calendar is in the top-left of the window, and I can enter descriptive text and hours worked for whatever date is selected in the calendar.


Glad you're finding it useful...

I create it onscreen, and then hook up the following events:

    calendarMorph
        when: #dateChanged send: #calendarDateChanged to: self;
        when: #menu send: #calendarMenu to: self.


- Jon



On Sun, Jan 20, 2013 at 9:06 PM, Sean P. DeNigris <[hidden email]> wrote:
Jon Hylands wrote
> a decent Calendar
> chooser... I spent a few hours and
> made what I think is a nice one...

This thing is awesome!! Thanks a lot Jon for making it. It works great.

One question... how are you using it? I ask because the typical usage I've
seen (e.g. in web forms) is that a calendar appears, you select a date, and
it disappears, entering the date somewhere e.g. a text field. However, with
your calendar, it looks like after a date is selected, the calendar remains.
Presumably something would have to keep polling to see if a date was
selected... Is that what you're doing?

Thanks again for the awesome gift :)

Cheers,
Sean



--
View this message in context: http://forum.world.st/Calendar-Chooser-tp3980015p4664341.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.




Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Hannes Hirzel
Jon,

Yes, it is useful indeed. Good to have it back in Squeak.

I downloaded the latest trunk image from:
squeakci.org/job/SqueakTrunk/lastSuccessfulBuild/

to test it.

The integration into the menu system was not fine. It needed
initialization code.



Instead of

CalendarChooserMorph>>
date

        ^date


We need

CalendarChooserMorph>>
date

        date isNil ifTrue: [ self date: Date today].
        ^date


I added the updated version to the inbox

MCHttpRepository
        location: 'http://source.squeak.org/inbox'
        user: ''
        password: ''

as MorphicExtras-hjh.106


--Hannes

On 1/21/13, Jon Hylands <[hidden email]> wrote:

> Sean,
>
> I'm using it in a timesheet tracking application. Basically, the calendar
> is in the top-left of the window, and I can enter descriptive text and
> hours worked for whatever date is selected in the calendar.
>
>
> Glad you're finding it useful...
>
> I create it onscreen, and then hook up the following events:
>
>     calendarMorph
>         when: #dateChanged send: #calendarDateChanged to: self;
>         when: #menu send: #calendarMenu to: self.
>
>
> - Jon
>
>
>
> On Sun, Jan 20, 2013 at 9:06 PM, Sean P. DeNigris
> <[hidden email]>wrote:
>
>> Jon Hylands wrote
>> > a decent Calendar
>> > chooser... I spent a few hours and
>> > made what I think is a nice one...
>>
>> This thing is awesome!! Thanks a lot Jon for making it. It works great.
>>
>> One question... how are you using it? I ask because the typical usage
>> I've
>> seen (e.g. in web forms) is that a calendar appears, you select a date,
>> and
>> it disappears, entering the date somewhere e.g. a text field. However,
>> with
>> your calendar, it looks like after a date is selected, the calendar
>> remains.
>> Presumably something would have to keep polling to see if a date was
>> selected... Is that what you're doing?
>>
>> Thanks again for the awesome gift :)
>>
>> Cheers,
>> Sean
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/Calendar-Chooser-tp3980015p4664341.html
>> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Sean P. DeNigris
Administrator
In reply to this post by Jon Hylands
Jon Hylands wrote
    calendarMorph
        when: #dateChanged send: #calendarDateChanged to: self
Have you made improvements since you posted the .st to this thread? Sending when:send:to: doesn't seem to have any effect for me (i.e. the handler is never activated). I'm attaching (to Nabble) a little class that shows the situation...

CalendarTester.st
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Jon Hylands
I've definitely made changes since then. My current implementation of #date: looks like this:

date: aDate

    | recompute |
    recompute := date isNil or: [date month ~= aDate month].
    date := aDate.
    recompute
        ifTrue: [self computeDays].
    self triggerEvent: #dateChanged.
    self changed: #dateChanged

So the event stuff got added after I posted that to the list.

If someone can walk me through it or point me to a page that describes how to do it, I can update the inbox with my current code.

I'm not sure why date needs to be lazy-initialized in the getter, since the instance creation methods #on: and #openOn: both set it to the date you pass in.

- Jon



On Mon, Jan 21, 2013 at 6:36 AM, Sean P. DeNigris <[hidden email]> wrote:
Jon Hylands wrote
>     calendarMorph
>         when: #dateChanged send: #calendarDateChanged to: self

Have you made improvements since you posted the .st to this thread? Sending
when:send:to: doesn't seem to have any effect for me (i.e. the handler is
never activated). I'm attaching (to Nabble) a little class that shows the
situation...

CalendarTester.st <http://forum.world.st/file/n4664401/CalendarTester.st>



--
View this message in context: http://forum.world.st/Calendar-Chooser-tp3980015p4664401.html
Sent from the Squeak - Dev mailing list archive at Nabble.com.




Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Hannes Hirzel
Jon

first of all you need to get a current trunk image from

squeakci.org/job/SqueakTrunk/lastSuccessfulBuild/

and file it in there and make it work ther.
More steps in a next email.

I filed in your latest change set into the trunk image. It works fine
if when you call it through
  #on: aDate

method.

However if you call it through the 'World Menu' -> 'New morph' a
debugger comes up because date is not initialized.

HTH

--Hannes


On 1/22/13, Jon Hylands <[hidden email]> wrote:

> I've definitely made changes since then. My current implementation of
> #date: looks like this:
>
> date: aDate
>
>     | recompute |
>     recompute := date isNil or: [date month ~= aDate month].
>     date := aDate.
>     recompute
>         ifTrue: [self computeDays].
>     self triggerEvent: #dateChanged.
>     self changed: #dateChanged
>
> So the event stuff got added after I posted that to the list.
>
> If someone can walk me through it or point me to a page that describes how
> to do it, I can update the inbox with my current code.
>
> I'm not sure why date needs to be lazy-initialized in the getter, since the
> instance creation methods #on: and #openOn: both set it to the date you
> pass in.
>
> - Jon
>
>
>
> On Mon, Jan 21, 2013 at 6:36 AM, Sean P. DeNigris
> <[hidden email]>wrote:
>
>> Jon Hylands wrote
>> >     calendarMorph
>> >         when: #dateChanged send: #calendarDateChanged to: self
>>
>> Have you made improvements since you posted the .st to this thread?
>> Sending
>> when:send:to: doesn't seem to have any effect for me (i.e. the handler is
>> never activated). I'm attaching (to Nabble) a little class that shows the
>> situation...
>>
>> CalendarTester.st <http://forum.world.st/file/n4664401/CalendarTester.st>
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/Calendar-Chooser-tp3980015p4664401.html
>> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

dcorking
Thanks for a nice new morph, Jon.

I posted 3 little SUnit tests for initialization.

http://source.squeak.org/inbox/MorphicTests-dcorking.19.mcz

I am afraid they are not well factored, which reflects my
inexperience. However, they seem to go yellow and green at the right
times with Hannes's bundle of Jon's code: MorphicExtras-hjh.106 on a
current trunk image.

Did I put them in the right category? I called it
#'MorphicTests-CalendarChooser' but you might prefer
#'MorphicTests-Extras'.

Jon wrote:
> I'm not sure why date needs to be lazy-initialized in the getter, since the instance creation
> methods #on: and #openOn: both set it to the date you pass in.

I don't think it needs to be lazy-initialized: #initialize method is
ok too. Most morph classes create a working default morph in response
to #new (for example, as sent from
TheWorldMenu>>newMorphOfClass:event: )

However, like CalendarChooserMorph, some morph classes don't like #new
, such as ProjectViewMorph. I guess it is a matter of opinion, but
since it is easy to do, I like Hannes's suggestion.

> If someone can walk me through it or point me to a page that describes how to do it, I can
> update the inbox with my current code.

IMHO we need such a page. I found section '6.3 Monticello' in 'Squeak
By Example' very helpful at getting started, as it walked me through
pushing code to an http repository just like
http://source.squeak.org/inbox . The inbox is world writeable so
doesn't need a username or password.

Have fun! David

Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

dcorking
In reply to this post by Jon Hylands
On Tue, Jan 22, 2013 at 7:57 PM, Jon Hylands wrote:
> I've definitely made changes since then. My current implementation of #date:
> looks like this:
>
> date: aDate
<snip>
>     self triggerEvent: #dateChanged.
>     self changed: #dateChanged
>
> So the event stuff got added after I posted that to the list.
>
> If someone can walk me through it or point me to a page that describes how
> to do it, I can update the inbox with my current code.

I pushed a test for that event into the inbox:
http://source.squeak.org/inbox/MorphicTests-dcorking.21.mcz

#testShouldSendDateChangedEvent should fail until you (Jon) push your
code. There is no hurry for that. (I have committed your change
locally, and I could push that if you wish.)

Have fun! David

p.s. My commit includes an empty test:
#testShouldNotSendDateChangedWhenUnchanged as an 'expectedFailure'
(green) to document that the event is sent whenever #date: is sent,
even when the date remains the same.

Reply | Threaded
Open this post in threaded view
|

Re: Calendar Chooser

Jon Hylands
David,

I'm in California on business this week, but I'll be flying back home tomorrow. I'll have a closer look at this stuff in detail next week.

Thanks,
Jon



On Fri, Jan 25, 2013 at 8:44 AM, David Corking <[hidden email]> wrote:
On Tue, Jan 22, 2013 at 7:57 PM, Jon Hylands wrote:
> I've definitely made changes since then. My current implementation of #date:
> looks like this:
>
> date: aDate
<snip>
>     self triggerEvent: #dateChanged.
>     self changed: #dateChanged
>
> So the event stuff got added after I posted that to the list.
>
> If someone can walk me through it or point me to a page that describes how
> to do it, I can update the inbox with my current code.

I pushed a test for that event into the inbox:
http://source.squeak.org/inbox/MorphicTests-dcorking.21.mcz

#testShouldSendDateChangedEvent should fail until you (Jon) push your
code. There is no hurry for that. (I have committed your change
locally, and I could push that if you wish.)

Have fun! David

p.s. My commit includes an empty test:
#testShouldNotSendDateChangedWhenUnchanged as an 'expectedFailure'
(green) to document that the event is sent whenever #date: is sent,
even when the date remains the same.