d_list_proc(3)
π d_list_proc(3) β bestie edition π
okay so like, welcome to the Allegro manual, page for d_list_proc(3). this is the Allegro game programming library, and today we're talking about one specific little guy. sit down, get comfy, grab a strawberry π
β¨ NAME β¨
d_list_proc β a dialog procedure that implements a list box object. yep, that's the whole vibe. Allegro game programming library, no cap. π
π¦ SYNOPSIS π¦
#include <allegro.h>
int d_list_proc(int msg, DIALOG *d, int c);
look at that signature. iconic. no notes. β¨
πΈ DESCRIPTION πΈ
so bestie, d_list_proc is a list box object. the way that it works is it lets the user scroll through a whole list of items and pick one β either by clicking on it, or by using the arrow keys. very demure, very mindful. π
and here's a lil something: if the D_EXIT flag is set, then double clicking on a list item will close the dialog. boom. done. exit stage left. π
now, where does it keep track of stuff? listen up:
- the index of the selected item lives in the
d1field. - the
d2field is used to store how far it has scrolled through the list. - the
dpfield points to a function, and that function gets called to obtain information about the contents of the list.
that function? it should follow this exact form, fr fr:
char *foobar(int index, int *list_size);
here's the tea on how that callback is supposed to behave:
- if
indexis zero or positive, the function should return a pointer to the string that is 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.
periodt. π
π multiple selection listboxes π
okay this part is giving main character energy, so pay attention. if you wanna create a multiple selection listbox, you set the dp2 field to an array of byte flags indicating the selection state of each list item β non-zero for selected entries. π
β οΈ and this is the important bit, no skipping: that table must be at least as big as the number of objects in the list! like, do not play with this one. the table has to be big enough. fr fr. π
π SEE ALSO π
exgui(3)β go look, bestie π«Ά
and that's the whole page! this little masterpiece came from the Allegro crew, version 4.4.3, and it's filed under d_list_proc(3). mwah, slay, go build something cute with it πβ¨π¦
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms