Calendar Widget - feedback on a past attempt

Moderators: LCMark, LCfraser

Post Reply
Zryip TheSlug
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Tue Jan 26, 2010 10:15 pm
Contact:

Calendar Widget - feedback on a past attempt

Post by Zryip TheSlug » Fri Nov 25, 2016 11:48 am

I've just have a look to the Eleanor's calendar widget in comparison to my attempt, one year ago.

Creating a calendar widget was my second exercice experience with widgets and here is a feedback in case it would be useful for the Team.

1. First I found the com.livecode.date library really poor for the exercice and I filed this suggestion in the qcc:
http://quality.livecode.com/show_bug.cgi?id=15172

2. But this not stopped me, and I tried the "execute script" command for doing date calculation.
Unfortunately the "convert" command is not returning something in the result, and I was never be able to get something from it in LCB.
Here I stopped my project with a poor grid of 42 cases and I waited for an addition in the date library.

Now I have the Eleanor's widget in hand, it appears I should have managed all by hand by creating my own date and hour lib. In my opinion dates and times operations should be included in the com.livecode.date. Have to create such a library appears to an attempt to reinvent the wheel. This is in the same level than to have no arithmetic operators available in a language.
This is probably a specific need about the projects I would have had in term of widgets and librairies, but really I would have preferred to not have to code the basic part (with the risk to introduce bugs), before to be able to drive my widget ferrari on the track.
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3187
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Calendar Widget - feedback on a past attempt

Post by bn » Fri Nov 25, 2016 1:36 pm

Hi Zryip,

good to see/read you again.
2. But this not stopped me, and I tried the "execute script" command for doing date calculation.
Unfortunately the "convert" command is not returning something in the result, and I was never be able to get something from it in LCB.
this works for me

Code: Select all

	variable tScriptList as List
	variable tScript as String
	variable tResult as String
	push "put the date && the long time into tTemp" onto tScriptList
	push "convert tTemp to dateItems" onto tScriptList
	push "return tTemp" onto tScriptList
	combine tScriptList with newline into tScript
	execute script tScript
	put the result into tResult
	log tResult
it returns the dateItems
"2016,11,25,13,18,55,6"
I think you experience what I also found out: to get used to LCBuilder language takes quite a while and it is often hard to figure out what makes it fail. (no debugger) The language is a lot less forgiving than LCScript.

But I think if you get over the bumpy beginnings you will like it :) LCB is still in flux but it is amazing what you can already do.

I guess that you have seen my modification of Elanor's calendar widget. I among other things provided the option to start the week on Monday. If you don't know it I will post a link. For me the date library worked fine. But i did not use it beyond Elanor's use in the calendar widget. Sure, a native LCB equivalent to the date/time/dateItems of LCScript would be very welcome.

By the way I personally know some people that almost gave up on LCB and that are now all for it and enjoy it.

Maybe give LCB a chance and be prepared to work around stuff that is not there yet and to debug like it is 1990, log, log, log.

Kind regards
Bernd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3187
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Calendar Widget - feedback on a past attempt

Post by bn » Fri Nov 25, 2016 2:10 pm

Oh,
look at what others have done, first all the LC widgets and then
Trevor's repository
https://github.com/trevordevore/livecode-extensions
and his blogs
http://www.bluemangolearning.com/liveco ... e-builder/
Kind regards
Bernd

Zryip TheSlug
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Tue Jan 26, 2010 10:15 pm
Contact:

Re: Calendar Widget - feedback on a past attempt

Post by Zryip TheSlug » Fri Nov 25, 2016 3:21 pm

Hi Bernd,

Thanks. I never thought to push and combine several lines to compose the script like with the do command. This is changing my approach of things.

May be you might have other answers for me:
If the exercice would consist to replace the Eleanor's library by another one, based this time on the convert command.

1. I'm excluding performances problem, and will hope the execute script is as quick to execute than a native LCB sentence.
2. Based on my old tests with the 2015 alpha version, the main problem with the executive script command is we can not executed it everywhere. Especially in the onPaint message.
- Do the execute script is working when nested in a custom library, even if the lib function is executed in the onPaint message?
- If not, what would be the workaround?


I'm beginning with LCB since the first alpha version. So this is a very long beginning. Every time I had the time to explore LCB (some hours in each 3 or 4 months), I spent all my time to keep my first attempts compatible with the syntax changes (undefined becoming nothing, changes in variable type, case sensitive changes and others things I don't remember at this moment) instead to explore the possibilities or just trying to finish what I've started.
And I've wait for the nested widgets feature, which I have missed the announce. By reading the doc (again) yesterday, I found the entries for them and I don't know when exactly they have been added.

So sorry for my frustration, but yes all of this is frustrating me :)

When I was a kind of developer until 2011 I worked a lot in php with notepad++. This was a lot of echo and printr commands to debug things. So no need to back me in 1990 :)

Now I'm focusing my free time on another project. Even if I'm still in the LCB forum trying to learn from my errors, I've not the time at this moment to begin again with widgets. Just to think about what I could have be done.


Best Regards,
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3187
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Calendar Widget - feedback on a past attempt

Post by bn » Fri Nov 25, 2016 10:09 pm

Hi Zryip,
2. Based on my old tests with the 2015 alpha version, the main problem with the executive script command is we can not executed it everywhere. Especially in the onPaint message.
- Do the execute script is working when nested in a custom library, even if the lib function is executed in the onPaint message?
- If not, what would be the workaround?
the onPaint command is special. Mark Waddingham always warned to overload the onPaint handler. But depending on what you are doing you could put the execute script almost anywhere. In a onGeometryChanged or before you issue a redraw all command.
as far as a library is concerned you will usually not need the library only during onPaint. Anywhere outside of onPaint a call to the library should work for execute script though I have not tested that.

Mark Waddingham frowns a bit on overuse of execute script and I agree. I do it only if I don't find a LCB native solution like the abbreviated month day/names for the system (local) names . It is very tempting to resort to LCScript but often a native LCB solution is just a little harder to figure out.

Recently Hermann filed for an enhancement in the Quality Control Center
http://quality.livecode.com/show_bug.cgi?id=18734

He got an answer from Peter Brett for a technique that he since uses routinely and extensively. He started a new thread
http://forums.livecode.com/viewtopic.php?f=93&t=28225

I am sure you will appreciate the intricacies and potential of the approach. And maybe the generic handler solution and Hermann's examples in the "community snippets" thread will give you some ideas.

In short I believe the potential of LCB is huge, with the potential to be compiled and because of binding to foreign functions (Infinite Livecode project)

Last year coming back from the south of France I passed your "backyard", was tempted to get off the autoroute and ask in the local cafe for Zryip :) :) :)

Kind regards
Bernd

Zryip TheSlug
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 118
Joined: Tue Jan 26, 2010 10:15 pm
Contact:

Re: Calendar Widget - feedback on a past attempt

Post by Zryip TheSlug » Tue Nov 29, 2016 4:16 pm

Hi Bernd,

Thanks for your reply. I will think to all of that.
I had a look to the Hermann's widgets in HTML5. Very impressive result!

By the way, the better place where you will find me is in gardens. :)


Best Regards,
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel

Post Reply

Return to “LiveCode Builder”