combo Function

private function combo(self, label, index, items) result(changed)

A combo box (a drop-down menu) of items (trailing blanks trimmed), showing item index (1-based): true (and index changed) after the user chose another.

Type Bound

Gui

Arguments

Type IntentOptional Attributes Name
class(Gui), intent(inout) :: self
character(len=*), intent(in) :: label

the text next to it

integer, intent(inout) :: index

the item shown (1-based; changed by the user)

character(len=*), intent(in) :: items(:)

the menu's items (trailing blanks trimmed)

Return Value logical


Calls

proc~~combo~~CallsGraph proc~combo Gui%combo interface~vkf_gui_combo vkf_gui_combo proc~combo->interface~vkf_gui_combo

Source Code

    logical function combo(self, label, index, items) result(changed)
        class(Gui), intent(inout) :: self
        character(len=*), intent(in) :: label           !! the text next to it
        integer, intent(inout) :: index                 !! the item shown (1-based; changed by the user)
        character(len=*), intent(in) :: items(:)        !! the menu's items (trailing blanks trimmed)
        character(len=:), allocatable :: all
        integer(c_int) :: i
        integer :: k
        all = ''
        do k = 1, size(items)
            all = all//trim(items(k))
            if (k < size(items)) all = all//new_line('a')
        end do
        i = int(index - 1, c_int)
        changed = vkf_gui_combo(self%handle, label, len(label, kind=c_int), i, all, len(all, kind=c_int)) /= 0
        index = i + 1
    end function combo