d_list_proc(3alleg4)
π d_list_proc β bestie edition
okay so real talk, this is from the Allegro manual, and it's about a little dialog thing called d_list_proc. It's a dialog procedure that implements a list box object π β part of the Allegro game programming library, iykyk.
β¨ SYNOPSIS β¨
#include <allegro.h>
int d_list_proc(int msg, DIALOG *d, int c);
π¦ DESCRIPTION π¦
It's giving list box object. π What that means is: your user can scroll through a whole list of items, and pick one β either by clicking on it, or with the arrow keys. Both work, no cap.
If the D_EXIT flag is set, then double clicking on a list item closes the dialog. Iconic behaviour honestly.
Here's the tea on where everything lives:
d1β holds the index of the item that's currently selected πd2β used to store how far it has scrolled through the listdpβ points to a function that gets called to obtain info about the contents of the list
That function in dp should follow this form, fr fr:
char *foobar(int index, int *list_size);
How it works, step by step bestie:
- If
indexis zero or positive, the function should return a pointer to the string that's to be displayed at positionindexin the list. β¨ - If
indexis negative, it should returnNULL, andlist_sizeshould be set to the number of items in the list.
πΈ MULTIPLE SELECTION LISTBOX πΈ
Wanna let your user pick more than one thing? Obsessed. Do this:
Set the dp2 field to an array of byte flags indicating the selection state of each list item β non-zero means that entry is selected. π
β οΈ bestie this is the important bit: this table must be at least as big as the number of objects in the list! Not smaller. Do not play with this. π
π«Ά SEE ALSO π«Ά
that's the whole vibe π this page was living in Allegro version 4.4.3, mwah π stay hydrated, read your man pages, periodt. π
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms