Page 1 of 1

Option menu query.

Posted: Tue Aug 05, 2025 12:15 pm
by CAsba
Hi all,
I'm trying to give the user the option of a date in the current year or the year after the current year. So, he clicks on button 'YEAR' and chooses a year, either 2025 or 2026. In the future of course, the years might be 2027 and 2028. The script must make reference to the current year. I have the current year in fld "temp" and the following year in fld "temp2", also in variables 'thisyear' and 'nextyear' . Is it possible to introduce either the variables or the fields to an option menu ? or is there an easier way to present the user with choosing a date either in the current year or the next year ? Any ideas ?

Re: Option menu query.

Posted: Tue Aug 05, 2025 12:48 pm
by Klaus
Hi CAsba,

not sure if LC comes with a calendar widget, but here is a free and highly customizable calendar widget from the famous bn:
<viewtopic.php?f=9&t=39225&hilit=Calendarius>
Scroll a bit down for the download URL. Hope that helps!


Best

Klaus

Re: Option menu query.

Posted: Tue Aug 05, 2025 2:27 pm
by dunbarx
CAsba.

Calendar widgets aside, the selection of a date is automatically handled by LC without issue. In other words, LC does not care what date you want to process.

As for your question, put this into the script of an option menu:

Code: Select all

on mouseEnter
   convert the date to dateItems
   put item 1 of it into currentyear
   put currentyear + 1 into nextYear
   put currentyear & return & nextYear into me
end mouseEnter
Now that button will always show the current year and the following year, forever.

Craig

Re: Option menu query.

Posted: Tue Aug 05, 2025 5:16 pm
by CAsba
Thanks Klaus, thanks Craig.
Klaus, I'll try what you suggest..
Craig, the option menu I've been working with is of type 'on menuPick pitemname'. I tried putting your code into it, but there was an error message.

Re: Option menu query.

Posted: Tue Aug 05, 2025 5:55 pm
by dunbarx
CAsba.

An option menu is just a button. My code has to go intact into the button script.

A separate handler can be a "menuPick" handler. "MenuPick" is a message sent to the button when a menuItem is chosen from the pulldown options. That is where you would act on the users choice.

Do you see? My handler loads the values available for selection, and will update forever. The other deals with the user choice:

Code: Select all

on menuPick pItemName
if pItemName = "2025" then answer "A good year" else answer "Next year already?"
...
Craig

Re: Option menu query.

Posted: Wed Aug 06, 2025 2:16 pm
by CAsba
HI,
To report back, I solved my problem by showing 2 buttons showing as a two-item drop-down menu, the labels and scripts of the buttons having reference to current year and current year + 1. It offers the choices a menu would, and to the casual observer (the user) it's similar in appearance to the drop down menus for mth and day.
Thanks everyone for your interest.

Re: Option menu query.

Posted: Wed Aug 06, 2025 3:54 pm
by dunbarx
CAsba

Whatever works for you, and you got more experience along the way.

But isn't one button better than two?

Craig