ChatGPT

Ken Ray kray at sonsothunder.com
Tue Dec 20 23:33:57 EST 2022


I just tried it and got this instead:

-----
ME: Write a calendar app in livecode

CHATGPT:

To create a calendar app in LiveCode, you will need to use the LiveCode programming language and the LiveCode development environment. Here is a step-by-step guide to help you get started:

	1. Open LiveCode and create a new stack.
	2. Design the layout of your calendar app. You can use LiveCode's built-in layout tools to create a grid of squares representing the days of the month, as well as buttons for navigating between months and years.
	3. Use LiveCode's control structures and looping statements to create the logic for displaying the current month and year, and for navigating between months and years.
	4. Add functionality to highlight the current day and to display events for each day. You can use LiveCode's data structures, such as lists and arrays, to store the events for each day.
	5. Use LiveCode's built-in date and time functions to help with the calendar calculations, such as determining the number of days in a given month and the day of the week for a given date.
	6. Test your calendar app thoroughly to ensure that it is working as expected.
	7. Customize the appearance of your calendar app using LiveCode's graphics and styling features.

I hope this helps! Let me know if you have any questions or need further guidance.
-----

Amazing!

Ken


> On Dec 9, 2022, at 3:54 PM, Jim Lambert via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Even more interesting I issued the same chat request a few hours later and got an entirely different coding approach. 
> It even helpfully put the code into formatted, copy-able blocks. (formatting not shown here.)
> 
> ME: Write a calendar app in livecode
> 
> CHATGPT:
> Here is an example of how you could implement a simple calendar app in LiveCode:
> 
> Copy code
> -- Set the default date to the current date put the short date into currentDate 
> 
> -- Create the calendar UI 
> create calendar 
> set the date of calendar to currentDate 
> set the rect of calendar to the rect of this card  
> 
> -- Function to handle date changes in the calendar 
> on dateChanged pNewDate 
> put pNewDate into currentDate 
> end dateChanged
> 
> This script creates a calendar widget and sets its default date to the current date. It also defines a dateChanged handler that is called whenever the selected date in the calendar changes. In this handler, the currentDate variable is updated with the new selected date.
> 
> You can then add other UI elements and functions to your app to allow the user to view and manage events for the selected date. For example, you could add a list widget to display the events for the current date, and buttons to add and remove events.
> 
> Here is an example of how you could add a list widget to display the events for the current date:
> 
> Copy code
> -- Create a list widget to display the events for the current date 
> create field "eventsList" 
> set the rect of "eventsList" to 100,100,200,200 
> set the text of "eventsList" to "No events for this date" 
> 
> -- Function to update the events list 
> on updateEventsList 
> -- Clear the events list 
> put empty into field "eventsList" 
> 
> -- Retrieve the events for the current date from a database or file 
> put the events for currentDate from database or file into events 
> 
> -- Add the events to the list 
> repeat for each event in events 
> put event & cr after field "eventsList"
> end repeat 
> end updateEventsList
> 
> This script creates a list widget called eventsList, and defines an updateEventsList function that retrieves the events for the current date from a database or file and adds them to the list.
> 
> You can then call the updateEventsList function whenever the date in the calendar changes, so that the list of events is updated to show the events for the new selected date. You can do this by adding the following code to the dateChanged handler:
> 
> Copy code
> on dateChanged pNewDate 
> put pNewDate into currentDate 
> updateEventsList 
> end dateChanged
> 
> You can also add buttons to allow the user to add and remove events. For example, you could add the following code to create "Add" and "Remove" buttons and define the corresponding event handlers:
> 
> Copy code
> -- Create "Add" and "Remove" buttons
> 
> But, of course, this code doesn't actually work. But it could be re-written to work.
> 
> JimL
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Website: https://www.sonsothunder.com






More information about the use-livecode mailing list