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 | Intent | Optional | 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) |
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