Page 3 of 4
Re: Calendar widget
Posted: Wed Dec 09, 2020 10:40 pm
by bn
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
Re: Calendar widget
Posted: Thu Dec 10, 2020 9:52 pm
by marksmithhfx
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)?
Re: Calendar widget
Posted: Fri Dec 11, 2020 9:33 am
by Klaus
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
Re: Calendar widget
Posted: Fri Dec 11, 2020 3:04 pm
by marksmithhfx
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
Re: Calendar widget
Posted: Fri Dec 11, 2020 4:04 pm
by marksmithhfx
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...

(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
Re: Calendar widget
Posted: Sat Dec 12, 2020 5:31 pm
by marksmithhfx
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
Re: Calendar widget
Posted: Sat Dec 12, 2020 5:58 pm
by Klaus
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
Re: Calendar widget
Posted: Sat Dec 12, 2020 8:41 pm
by marksmithhfx
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
Re: Calendar widget
Posted: Sat Dec 12, 2020 9:33 pm
by stam
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...)
Re: Calendar widget
Posted: Sun Dec 13, 2020 4:28 pm
by marksmithhfx
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?
Re: Calendar widget
Posted: Mon Dec 14, 2020 2:56 pm
by marksmithhfx
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
Re: Calendar widget
Posted: Fri Dec 18, 2020 4:13 pm
by marksmithhfx
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
Re: Calendar widget
Posted: Sat Dec 19, 2020 3:08 pm
by stam
OFF TOPIC -- but how do you create the 'Attachments' box in the forum post?
Re: Calendar widget
Posted: Sat Dec 19, 2020 3:50 pm
by Klaus
stam wrote: Sat Dec 19, 2020 3:08 pmOFF 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"...

Re: Calendar widget
Posted: Sat Jan 16, 2021 6:00 am
by stecxjo
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.
