Events

This is actually pretty easy to do. All you need is the number of events on a particular day, a blank text global and two touch formulas, but we'll add some more things for better customizability.

"Scroll" Today's Events

First a blank text global for the chosen date, a global that calculates the number of events on that date and another global for a chosen event. Then we also need globals for events' info.

Global Formulas

To control the events, create 3 text globals.

  1. To hold the chosen date:

gv(date)

$dp()$

  1. To hold the index number of the chosen event:

gv(event)

Leave it blank, it will be set by the touch action.
  1. To calculate the number of events on the chosen date

gv(events)

$ci(ecount, gv(date)) + ci(acount, gv(date))$

For the event info, create 4 text globals with these formulas:

gv(title)

$ci(title, gv(event), gv(date))$

gv(info)

$ci(desc, gv(event), gv(date))$

gv(period)

$if(ci(allday, gv(event, gv(date)), "All day", df("h:mma", ci(start, gv(event), gv(date)))+" - "+df("h:mma", ci(end, gv(event), gv(date))))$

gv(location)

$ci(loc, gv(event), gv(date))$

Making the Group

  • Make a horizontal stack group;

  • in it create two icons (left & right arrows) and a vertical stack group;

  • inside the vertical stack group add more stack groups, each with a text object linked to one of the global formulas above.

NOTE: The index of the objects in the stack doesn't matter here, but it is suggested that it has the same structure as the agenda.

Add Touch Formulas to the Icons

  • Action = Toggle Global Switch

  • Switch = gv(event)

  • Text =

  1. Previous:

$if(gv(event) > 0, gv(event)-1, 0)$

  1. Next:

$if(gv(event)+1 >= gv(events), gv(events)-1, gv(event)+1)$

Hide Empty Event Details

To hide the info and/or location when the event doesn't have any use the following formulas on their respective groups:

HideInfo

$if(tc(len, gv(info))>0, ALWAYS, REMOVE)$

HideLoc

$if(tc(len, gv(location))>0, ALWAYS, REMOVE)$

Open the Chosen Event in Calendar

Add a touch action to the Event group:

  • Action = Open link

  • Url = $ci(url, gv(event), gv(date))$


Copyright (c) 2021 Erik Bucik

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

BSD-3-Clause

Kustom formatted version