On the list display screen, list items is displayed in the list area as shown in the figure below, and menu items can be displayed in other areas.
Follow the steps below to display the list screen, wait for key input, and perform processing.
  1. Define the menu items and options in the same way as the basic usage.

  2. Generate a list resource by passing the menu items and options with the list area specification to the AL_CreateList function, and get the list handle to refer to that resource.
    Sample
        LIST_HANDLE hList;
        ...
        hList = AL_CreateList(ListMenuTable, (const pAM_Option)&ListOption, AM_PIX(18), 7);
    

    In the sample, the area for 7 lines from the position where the Y coordinate is 18 (pixel coordinate) is specified as the list area.

  3. Register the list items to be displayed in the list area with the AL_AddListItem function or AL_AddListItemEx function.
    サンプル
        AL_ListItem item;
        char *buffCode;
        char *buffName;
        char textBuff[21+1];
        ...
        item.listText = textBuff;
        item.paletteIndex = PX_BASE;
        item.showControl = AM_NO_CONTROL;
        item.userParam1 = (int)buffCode; //userParam1 for the code
        item.userParam2 = (int)buffName; //userParam2 for the name
    
        //Add list item
        if (!AL_AddListItem(hList, &item)){
            //Error
            ...
        }
    

    In the sample, userParam1 and userParam2 of the AL_ListItem structure are set to pointers to the memory allocated by the malloc function.

  4. Display the list screen with the AL_ShowList function.
    Sample
        AL_ShowList(hList, 0, 0);
    

  5. Waits for key input with AL_ExecList function and processes the event.
    The AL_ExecList function provides the following functionality:
    • Display the highlight on the list item that has focus.
    • Moves the focus up and down when you press the [Q1] key or the [Q2] key.
    • When more list items are registered than the number of rows in the list area, scroll the list up and down as the focus moves so that the list item with focus is always displayed in the list area.
    • Returns an event if there is any input.
    • If there is no input, wait for input while calling Idle function.
    Sample
        while(1){
            event = AL_ExecList(hList);
            if (event == CLEAR_KEY){
                //Exit
                break;
            }else{
                ...
            }
        }
    

  6. When closing the list screen, call the AL_ReleaseList function with the list handle to release the list resource.
    Sample
        AL_ReleaseList(hList);
    

See also

Last updated: 2020/10/16