Calendar widget

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4171
Joined: Sun Jan 07, 2007 9:12 pm

Re: Calendar widget

Post by bn » Wed Dec 09, 2020 10:40 pm

Hi Mark,

I tried your sample stack and as you say it does not work with a "navigation bar" widget.

However it works with the SVG Icon widget, the Header Bar widget and the Segemented control widget.

For Segmented control widget use "on hilitechanged" instead of "on mouseUp", the rest being the same as above script.

The probable reason why it does not work with the "navigation bar" widget is that the widget itself uses a popUp mechanism for tooltips in an experimental "editmode" mode.

Maybe one of the other widgets will do?

Kind regards
Bernd

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Calendar widget

Post by marksmithhfx » Thu Dec 10, 2020 9:52 pm

I have a question for you all, which comes partly as a suggestion from Elanor. She suggested, as a way around the popup problem on iOS, to hide/show a group. But I was wondering, can you "show" a group at a particular location (like mouseLoc for example)?
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Calendar widget

Post by Klaus » Fri Dec 11, 2020 9:33 am

Hi Mark,

sure, this is Livecode:

Code: Select all

...
set the loc of grp "currently hidden group" to the mouseloc
## Or wherever you like...
show grp  "currently hidden group" 
...
:-)

Best

Klaus

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Calendar widget

Post by marksmithhfx » Fri Dec 11, 2020 3:04 pm

Klaus wrote:
Fri Dec 11, 2020 9:33 am
Hi Mark,

sure, this is Livecode:

Code: Select all

...
set the loc of grp "currently hidden group" to the mouseloc
## Or wherever you like...
show grp  "currently hidden group" 
...
:-)
Wonderful, thanks Klaus!! (I figured there was a way, just wasn't sure how)

Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Calendar widget

Post by marksmithhfx » Fri Dec 11, 2020 4:04 pm

SparkOut wrote:
Thu Dec 03, 2020 1:05 am
Just as an aside, the determination of whether a year is a leap year is not solely judged by whether it is divisible by 4. (1900, for instance is not a leap year. Century years must be divisible by 400 to be a leap year.)
Revised function:

Code: Select all

function isaLeap pYear
   // returns true if it is a leap year
   if pYear mod 4 is not 0 then return false
   if pYear mod 100 is not 0 then return true
   if pYear mod 400 is 0 then return true
   return false
end isaLeap
Or this way... :wink: (for back in the day when (some) programming languages required you to write functions with a single return statement)

Code: Select all

function isLeap pYear
   // returns true if it is a leap year
   put false into tLeap
   if (pYear mod 4 = 0) and ((pYear mod 100 <> 0) or (pYear mod 400 = 0)) then put true into tLeap
   return tLeap
end isLeap
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Calendar widget

Post by marksmithhfx » Sat Dec 12, 2020 5:31 pm

Klaus wrote:
Fri Dec 11, 2020 9:33 am
Hi Mark,

sure, this is Livecode:

Code: Select all

...
set the loc of grp "currently hidden group" to the mouseloc
## Or wherever you like...
show grp  "currently hidden group" 
...
:-)
Klaus, a follow up question. Can you display a group on card A that is located on card B? like... show group "MyGroup" of card "B". I tried this and it did not display the group on A, but I suspect it was showing it on the invisible card B. Confused yet? Ok, the idea is to have a popup calendar that is a group. I don't want to have multiple examples of the calendar, just one, stored on a card called "controls". So when I am where I want to display the calendar I would write something like "show group "Calendar" of card "Controls" and it would popup. I have tried it on the same card and that works. Just not when I put it on a different card.

Thanks
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Calendar widget

Post by Klaus » Sat Dec 12, 2020 5:58 pm

Hi Mark,
show group "MyGroup" of card "B".
no, this is not directly possible, the group needs to be on the same card.
But you can do something like this:

Code: Select all

...
lock screen
place bg "Calender" onto this cd
## set its loc if neccessary
unlock screen
## Et voila, your group! :-)
...
Then you can later, if neccessary:

Code: Select all

...
remove grp "Calender" from this cd
...
Best

Klaus

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Calendar widget

Post by marksmithhfx » Sat Dec 12, 2020 8:41 pm

Klaus wrote:
Sat Dec 12, 2020 5:58 pm
Hi Mark,
show group "MyGroup" of card "B".
no, this is not directly possible, the group needs to be on the same card.
But you can do something like this:

Code: Select all

...
lock screen
place bg "Calender" onto this cd
## set its loc if neccessary
unlock screen
## Et voila, your group! :-)
...
Then you can later, if neccessary:

Code: Select all

...
remove grp "Calender" from this cd
...
Best

Klaus
Ok thanks. This is probably what I will end up doing since I need to have the same group appear on about 4 different cards.

Best,
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

stam
Posts: 3070
Joined: Sun Jun 04, 2006 9:39 pm

Re: Calendar widget

Post by stam » Sat Dec 12, 2020 9:33 pm

Or alternatively use a widget and pop it up at desired location. I do this with Hermann’s date picker widget, works well (his documentation in the widget itself has sample code how to do this...)

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Calendar widget

Post by marksmithhfx » Sun Dec 13, 2020 4:28 pm

stam wrote:
Sat Dec 12, 2020 9:33 pm
Or alternatively use a widget and pop it up at desired location. I do this with Hermann’s date picker widget, works well (his documentation in the widget itself has sample code how to do this...)
Thanks Stam. Are you doing this on iOS?
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Calendar widget

Post by marksmithhfx » Mon Dec 14, 2020 2:56 pm

Klaus wrote:
Sat Dec 12, 2020 5:58 pm
Hi Mark,
show group "MyGroup" of card "B".
no, this is not directly possible, the group needs to be on the same card.
But you can do something like this:

Code: Select all

...
lock screen
place bg "Calender" onto this cd
## set its loc if neccessary
unlock screen
## Et voila, your group! :-)
...
Klaus
Thanks Klaus, this was definitely the way to go. And by doing the following I could install it on a card when needed and not worry about it. Very simple.

Code: Select all

            if not exists(group "Calendar") then
               lock screen
               place bg "Calendar" onto this cd
               unlock screen
            end if
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am

Re: Calendar widget

Post by marksmithhfx » Fri Dec 18, 2020 4:13 pm

I ended up using the LC Calendar and popping it up (show/hide) in a group. Groups have their own visual effects so I was able to add the drop shadow effect, mimicking the way LC does it on the desktop. I also installed oversize left/right arrow buttons in the group to make it easier to use on mobile. I'm pretty satisfied with the result. I've attached an example stack in case anyone is looking for ideas.

Mark
Attachments
example calendar.livecode.zip
(5.17 KiB) Downloaded 262 times
Last edited by marksmithhfx on Mon Dec 21, 2020 2:18 pm, edited 1 time in total.
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

stam
Posts: 3070
Joined: Sun Jun 04, 2006 9:39 pm

Re: Calendar widget

Post by stam » Sat Dec 19, 2020 3:08 pm

OFF TOPIC -- but how do you create the 'Attachments' box in the forum post?

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Calendar widget

Post by Klaus » Sat Dec 19, 2020 3:50 pm

stam wrote:
Sat Dec 19, 2020 3:08 pm
OFF TOPIC -- but how do you create the 'Attachments' box in the forum post?
Below the entry field for your posting you should see two TABS, with "Options" being the active one.
Click on, you guessed, "Attachments"... 8)

stecxjo
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 11
Joined: Thu Sep 06, 2007 11:58 pm

Re: Calendar widget

Post by stecxjo » Sat Jan 16, 2021 6:00 am

Is there a way to get the calendar widget to respond to a mouseUp message? It did not respond to one when I put that handler into the widget's script. As a workaround experiment,I tried making the widget its own group and put the message there. Of course,I could create a button as a control that would do what I want.

What do I want? I don't know yet, but I know I want to control something. :)

Post Reply