OpenAI GPTs Experiment

I fed the MIT App Inventor 2 language reference materials into a GPT to see if it can be a useful helper. Here is one session. Unfortunately I was unable to save the GPT, but it can be rebuilt with the materials I have gathered:

You
how can I center a label in a horizontal arrangement?

App Inventor Ally
To center a label in a horizontal arrangement in MIT App Inventor, you would typically need to adjust the properties of the horizontal arrangement to center the contents. Here is how you can do it:

  1. Click on the "HorizontalArrangement" component in the designer.
  2. In the properties panel, set the "HorizontalAlignment" property to "Center".
  3. Additionally, you can also set the "VerticalAlignment" property to "Center" to ensure the label is centered both horizontally and vertically within the arrangement.

This will center the label within the horizontal arrangement container​​.

In addition to explaining how the designer and blocks work, it tries to assist with coding examples when prompted:

User

You

can you give an example of listpicker usage?

App Inventor Ally

Certainly! Let's create an example where we use the ListPicker to let users choose their favorite fruit from a list. This example will include creating the ListPicker, populating it with fruit names, and then doing something with the user's choice. We'll break it down into simple steps:

Step 1: Adding the ListPicker to Your App

First, you need to add the ListPicker component to your app's screen. You can do this in the Designer section of MIT App Inventor.

Step 2: Populating the ListPicker with Fruit Names

You can populate the ListPicker with a list of fruits either directly in the Designer or using blocks in the Blocks Editor. For example, you might use the ElementsFromString property to add a list of fruits like "Apple, Banana, Cherry".

Step 3: Customizing the ListPicker (Optional)

You can customize the appearance of your ListPicker, like setting its background color, font size, or adding an image.

Step 4: Handling the User's Choice

When the user picks a fruit, you might want to display their choice in a label or use it in some other way. For this, you'll use the AfterPicking event.

Here's how you can set it up in the Blocks Editor:

  • AfterPicking Block: When the user selects a fruit, the AfterPicking event is triggered. Inside this event, you can get the user's choice using the Selection property of the ListPicker.
  • Set Label Text: You might have a label in your app to display the user's choice. You can set the text of this label to the ListPicker's Selection property, which contains the name of the fruit the user picked.

Example Blocks:

  1. ListPicker.AfterPicking: Inside this block, you add a block to set the text of a label (let's call it Label1) to the selected fruit.
  • set Label1.Text to ListPicker.Selection

This simple example demonstrates how the ListPicker can be used to create an interactive element in your app, allowing users to choose from a set of predefined options and then using their choice in your app's logic.

END

1 Like