D4CD_LISTBOX - Gargy007/D4CD GitHub Wiki

D4CD_LISTBOX object is defined for standard list box use - select the item from a list. The list box object is using pre/post texts like D4CD_LABEL to simplify creating the application screen with this object. The selection of list box item is done by “focus“character on left side of object (same as D4CD_CHECKBOX is using).

Example:

  • (red - pretext, green - item, blue - post text)

D4CD_LISTBOX

Declaration

The declaration is divided into three part (begin, items, end) to allow simply declare list box object with unspecified count of items. D4CD_DECLARE_LIST_BOX_BEGIN(name, preText, postText, x, y, cx, flags, pUser, pOnValch, pOnUsrMsg)

  • name - name of object
  • preText - pointer to text that is printed before list box item
  • postText - pointer to text that is printed after list box item
  • x,y - coordination of list box
  • cx - full length of list box object
  • flags - system flags of object
  • pUser - user data/pointer
  • pOnValch - pointer on pOnValch function
  • pOnUsrMsg - pointer on user message function

D4CD_DECLARE_LIST_BOX_ITEM(pItemText, pItemUserPointer)

  • pItemText - pointer of item text
  • pItemUserPointer - item user pointer

D4CD_DECLARE_LIST_BOX_END

API functions

Function that sets list box item index in runtime.

void D4CD_ListBoxSetIndex(D4CD_OBJECT_PTR pThis, D4CD_LIST_BOX_INDEX index)

Function that gets list box item index in runtime.

D4CD_LIST_BOX_INDEX D4CD_ListBoxGetIndex(D4CD_OBJECT_PTR pThis)

Function that gets list box items count in runtime.

D4CD_LIST_BOX_INDEX D4CD_ListBoxGetItemCount(D4CD_OBJECT_PTR pThis)

Function that try to find item index by user data/pointer.

D4CD_LIST_BOX_INDEX D4CD_ListBoxFindUserDataItem(D4CD_OBJECT_PTR pThis, void* pUser)

Function that gets list box item user data/pointer in runtime.

void* D4CD_ListBoxGetItemUserData(D4CD_OBJECT_PTR pThis)

Function that gets list box item text pointer in runtime.

D4CD_CHAR* D4CD_ListBoxGetItemText(D4CD_OBJECT_PTR pThis)