{"id":18847837,"url":"https://github.com/interkosmos/fortran-dialog","last_synced_at":"2026-02-01T23:30:14.064Z","repository":{"id":65921399,"uuid":"601849172","full_name":"interkosmos/fortran-dialog","owner":"interkosmos","description":"Library to create text user interfaces in Fortran 2008","archived":false,"fork":false,"pushed_at":"2024-07-04T11:22:52.000Z","size":89,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-30T13:57:38.728Z","etag":null,"topics":["dialog","fortran","fortran-2008","fortran-package-manager","fpm","tui","xdialog"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/interkosmos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-02-15T00:29:50.000Z","updated_at":"2024-07-04T11:22:55.000Z","dependencies_parsed_at":"2023-12-02T09:42:20.845Z","dependency_job_id":null,"html_url":"https://github.com/interkosmos/fortran-dialog","commit_stats":{"total_commits":18,"total_committers":1,"mean_commits":18.0,"dds":0.0,"last_synced_commit":"ae064deff3b36f4a37df79126eb2d73b83975197"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-dialog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-dialog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-dialog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interkosmos%2Ffortran-dialog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interkosmos","download_url":"https://codeload.github.com/interkosmos/fortran-dialog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239786209,"owners_count":19696770,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dialog","fortran","fortran-2008","fortran-package-manager","fpm","tui","xdialog"],"created_at":"2024-11-08T03:09:50.521Z","updated_at":"2026-02-01T23:30:14.015Z","avatar_url":"https://github.com/interkosmos.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fortran-dialog\nA work-in-progress wrapper module around [dialog](https://invisible-island.net/dialog/)\nto create text user interfaces in Fortran 2008, similar to\n[pythondialog](https://pythondialog.sourceforge.io/) for Python.\n\nPackages of *dialog(1)* are available for most Unix-like operating systems. On\nFreeBSD, an older version of dialog is already part of the base system. Install\nthe package `devel/cdialog` for an enhanced port:\n\n```\n# pkg install devel/cdialog\n```\n\nAdd an alias to your global `profile`, or set the backend to `cdialog` before\ncalling any dialog routines from Fortran:\n\n```fortran\ncall dialog_backend('cdialog')\n```\n\nThe basic widgets are compatible to [Xdialog](http://xdialog.free.fr/) as well.\nJust set the backend to `Xdialog`.\n\n## Coverage\n\n| Widget         | Supported |\n|----------------|-----------|\n| `buildlist`    |     ✓     |\n| `calendar`     |     ✓     |\n| `checklist`    |     ✓     |\n| `dselect`      |     ✓     |\n| `editbox`      |     ✓     |\n| `form`         |     ✓     |\n| `fselect`      |     ✓     |\n| `gauge`        |     ✓     |\n| `infobox`      |     ✓     |\n| `inputbox`     |     ✓     |\n| `inputmenu`    |     ✓     |\n| `menu`         |     ✓     |\n| `mixedform`    |     ✓     |\n| `mixedgauge`   |     ✓     |\n| `msgbox`       |     ✓     |\n| `pause`        |     ✓     |\n| `passwordbox`  |     ✓     |\n| `passwordform` |     ✓     |\n| `prgbox`       |     ✓     |\n| `programbox`   |     ✓     |\n| `progressbox`  |     ✓     |\n| `radiolist`    |     ✓     |\n| `rangebox`     |     ✓     |\n| `tailbox`      |     ✓     |\n| `tailboxbg`    |           |\n| `textbox`      |     ✓     |\n| `timebox`      |     ✓     |\n| `treeview`     |     ✓     |\n| `yesno`        |     ✓     |\n\n## Build Instructions\n\nDownload the *fortran-dialog* repository, and execute the Makefile:\n\n```\n$ git clone https://github.com/interkosmos/fortran-dialog\n$ cd fortran-dialog/\n$ make\n```\n\nIf you prefer the [Fortran Package Manager](https://github.com/fortran-lang/fpm),\nrun:\n\n```\n$ fpm build --profile=release\n```\n\nYou can add *fortran-dialog* as a dependency to your `fpm.toml`:\n\n```toml\n[dependencies]\nfortran-dialog = { git = \"https://github.com/interkosmos/fortran-dialog.git\" }\n```\n\n## Example\n\nThe following example just shows a message box in terminal:\n\n```fortran\n! example.f90\nprogram main\n    use :: dialog\n\n    call dialog_msgbox('This is the message box widget.', 10, 30)\nend program main\n```\n\nLink the example against `libfortran-dialog.a`:\n\n```\n$ gfortran -o example example.f90 libfortran-dialog.a\n$ ./example\n```\n\nTo create a graphical message box with *Xdialog(1)*, write instead:\n\n```fortran\n! example.f90\nprogram main\n    use :: dialog\n\n    call dialog_backend('Xdialog')\n    call dialog_msgbox('This is the message box widget.', 10, 30)\nend program main\n```\n\n## Further Examples\n\nMore examples can be found in `examples/`:\n\n* **hamurabi** is a port of the simulation game [Hamurabi](https://en.wikipedia.org/wiki/Hamurabi_(video_game)).\n* **showcase** demonstrates all supported widget types.\n* **wumpus** is a port of the game [Hunt the Wumpus](https://en.wikipedia.org/wiki/Hunt_the_Wumpus).\n\nBuild the programs with *make*:\n\n```\n$ make examples\n```\n\n## Widgets\n\nThis section lists code snippets in Fortran for the supported *dialog(1)*\nwidgets. See the official website for\n[screen shots](https://invisible-island.net/dialog/dialog-figures.html).\n\n### buildlist\n\n```fortran\ncharacter(len=32) :: selected\ntype(dialog_type) :: dialog\ntype(list_type)   :: list(3)\n\nlist(1) = list_type('item1', 'List Item 1', 'on')\nlist(2) = list_type('item2', 'List Item 2')\nlist(3) = list_type('item3', 'List Item 3')\n\ncall dialog_buildlist(dialog, 'Select items:', 16, 40, 5, list, \u0026\n                      title='Build List')\ncall dialog_read(dialog, selected)\ncall dialog_close(dialog)\n\nprint '(\"Selected items: \", a)', trim(selected)\n```\n\n### calendar\n\n```fortran\ncharacter(len=12) :: date\ntype(dialog_type) :: dialog\n\ncall dialog_calendar(dialog, 'Enter date:', 3, 42, day=1, month=1, year=2025, \u0026\n                     title='Calendar')\ncall dialog_read(dialog, date)\ncall dialog_close(dialog)\n\nprint '(\"Date: \", a)', date\n```\n\n### checklist\n\n```fortran\ncharacter(len=32) :: selected\ntype(dialog_type) :: dialog\ntype(list_type)   :: list(3)\n\nlist(1) = list_type('item1', 'List Item 1', 'on')\nlist(2) = list_type('item2', 'List Item 2')\nlist(3) = list_type('item3', 'List Item 3')\n\ncall dialog_checklist(dialog, 'Select items:', 16, 40, 5, list, \u0026\n                      title='Check List')\ncall dialog_read(dialog, selected)\ncall dialog_close(dialog)\n\nprint '(\"Selected items: \", a)', trim(selected)\n```\n\n### dselect\n\n```fortran\ncharacter(len=512) :: path\ntype(dialog_type)  :: dialog\n\ncall dialog_dselect(dialog, '/', 18, 72, title='Select Directory')\ncall dialog_read(dialog, path)\ncall dialog_close(dialog)\n\nprint '(\"Directory: \", a)', trim(path)\n```\n\n### editbox\n\n```fortran\ncharacter(len=512) :: line\nlogical            :: eof\ntype(dialog_type)  :: dialog\n\ncall dialog_editbox(dialog, './examples/wumpus.f90', 18, 72, title='Edit Box')\n\ndo\n    call dialog_read(dialog, line, eof)\n    if (eof) exit\n    print '(a)', trim(line)\nend do\n\ncall dialog_close(dialog)\n```\n\n### form\n\n```fortran\ncharacter(len=32) :: user, shell, group\ntype(dialog_type) :: dialog\ntype(form_type)   :: form(3)\n\nform(1) = form_type('User:',  1, 1, 'user',    1, 10, 10, 0)\nform(2) = form_type('Shell:', 2, 1, '/bin/sh', 2, 10, 10, 0)\nform(3) = form_type('Group:', 3, 1, 'wheel',   3, 10, 10, 0)\n\ncall dialog_form(dialog, 'Set user data:', 16, 40, 5, form, \u0026\n                 ok_label='Submit', title='Form')\ncall dialog_read(dialog, user)\ncall dialog_read(dialog, shell)\ncall dialog_read(dialog, group)\ncall dialog_close(dialog)\n\nprint '(\"User:  \", a)', trim(user)\nprint '(\"Shell: \", a)', trim(shell)\nprint '(\"Group: \", a)', trim(group)\n```\n\n### fselect\n\n```fortran\ncharacter(len=512) :: path\ntype(dialog_type)  :: dialog\n\ncall dialog_fselect(dialog, '/', 18, 72, title='Select File')\ncall dialog_read(dialog, path)\ncall dialog_close(dialog)\n\nprint '(\"File: \", a)', trim(path)\n```\n\n### gauge\n\n```fortran\ncharacter, parameter :: NL = new_line('a')\n\ncharacter(len=3)  :: a\ninteger           :: i\ntype(dialog_type) :: dialog\n\ncall dialog_gauge(dialog, 'Progress:', 12, 32, 0, title='Gauge')\n\ndo i = 1, 100\n    select case (i)\n        case (:20)\n            call dialog_write(dialog, 'Validating ...' // NL)\n        case (21:40)\n            call dialog_write(dialog, 'Updating ...' // NL)\n        case (41:60)\n            call dialog_write(dialog, 'Doing more work ...' // NL)\n        case (61:80)\n            call dialog_write(dialog, 'Just a few seconds ...' // NL)\n        case (81:)\n            call dialog_write(dialog, 'Almost done ...' // NL)\n    end select\n\n    write (a, '(i0)') i\n    call dialog_write(dialog, 'XXX' // NL // a // NL)\nend do\n\ncall dialog_close(dialog)\n```\n\n### infobox\n\n```fortran\ncall dialog_infobox(new_line('a') // 'This is the info box widget.', \u0026\n                    8, 36, title='Information', sleep=2)\n```\n\n### inputbox\n\n```fortran\ncharacter(len=32) :: input\ntype(dialog_type) :: dialog\n\ncall dialog_inputbox(dialog, 'Enter your name:', 7, 32, 'Alice', title='Name')\ncall dialog_read(dialog, input)\ncall dialog_close(dialog)\n\nprint '(\"Input: \", a)', trim(input)\n```\n\n### inputmenu\n\n```fortran\ncharacter(len=32) :: renamed\nlogical           :: eof\ntype(dialog_type) :: dialog\ntype(menu_type)   :: menu(3)\n\nmenu(1) = menu_type('item1', 'Item 1')\nmenu(2) = menu_type('item2', 'Item 2')\nmenu(3) = menu_type('item3', 'Item 3')\n\ncall dialog_inputmenu(dialog, 'Input:', 16, 40, size(menu), menu, \u0026\n                      no_tags=.true., title='Input Menu')\n\ndo\n    call dialog_read(dialog, renamed, eof)\n    if (eof) exit\n    print '(a)', trim(renamed)\nend do\n\ncall dialog_close(dialog)\n```\n\n### menu\n\n```fortran\ncharacter(len=32) :: selected\ntype(dialog_type) :: dialog\ntype(menu_type)   :: menu(3)\n\nmenu(1) = menu_type('item1', 'Item 1')\nmenu(2) = menu_type('item2', 'Item 2')\nmenu(3) = menu_type('item3', 'Item 3')\n\ncall dialog_menu(dialog, 'Select an item:', 16, 40, size(menu), menu, \u0026\n                 no_tags=.true., title='Menu Demo')\ncall dialog_read(dialog, selected)\ncall dialog_close(dialog)\n\nprint '(\"Selected item: \", a)', trim(selected)\n```\n\n### mixedform\n\n```fortran\ncharacter(len=32) :: user, shell, group\ntype(dialog_type) :: dialog\ntype(form_type)   :: form(3)\n\nform(1) = form_type('User:',  1, 1, 'user',    1, 10, 10, 0, 2)\nform(2) = form_type('Shell:', 2, 1, '/bin/sh', 2, 10, 10, 0, 0)\nform(3) = form_type('Group:', 3, 1, 'wheel',   3, 10, 10, 0, 0)\n\ncall dialog_mixedform(dialog, 'Set user data:', 16, 40, 5, form, \u0026\n                      ok_label='Submit', title='Mixed Form')\ncall dialog_read(dialog, user)\ncall dialog_read(dialog, shell)\ncall dialog_read(dialog, group)\ncall dialog_close(dialog)\n\nprint '(\"User:  \", a)', trim(user)\nprint '(\"Shell: \", a)', trim(shell)\nprint '(\"Group: \", a)', trim(group)\n```\n\n### mixedgauge\n\n```fortran\ncharacter(len=4) :: a\ninteger          :: i\ntype(gauge_type) :: gauge(10)\n\ngauge(1) = gauge_type('Process one',   '0')\ngauge(2) = gauge_type('Process two',   '1')\ngauge(3) = gauge_type('Process three', '2')\ngauge(4) = gauge_type('Process four',  '3')\ngauge(5) = gauge_type('',              '8')\ngauge(6) = gauge_type('Process five',  '5')\ngauge(7) = gauge_type('Process six',   '6')\ngauge(8) = gauge_type('Process seven', '7')\ngauge(9) = gauge_type('Process eight', '4')\n\ndo i = 0, 100, 20\n    write (a, '(\"-\", i0)') i\n    gauge(10) = gauge_type('Process nine', a)\n    call dialog_mixedgauge('Progress:', 20, 64, 33, gauge, title='Mixed Gauge')\n    call sleep(1)\nend do\n```\n\n### msgbox\n\n```fortran\ncall dialog_msgbox('This is the message box widget.', 8, 36, \u0026\n                   backtitle='msgbox', title='Message')\n```\n\n### passwordbox\n\n```fortran\ncharacter(len=32) :: password\ntype(dialog_type) :: dialog\n\ncall dialog_passwordbox(dialog, 'Enter password:', 7, 32, \u0026\n                        insecure=.true., title='Password')\ncall dialog_read(dialog, password)\ncall dialog_close(dialog)\n\nprint '(\"Password: \", a)', trim(password)\n```\n\n### passwordform\n\n```fortran\ncharacter(len=32) :: uuid, password\ntype(dialog_type) :: dialog\ntype(form_type)   :: form(2)\n\nform(1) = form_type('UUID:',     1, 1, '12345',  1, 10, 10, 0)\nform(2) = form_type('Password:', 2, 1, 'secret', 2, 10, 10, 0)\n\ncall dialog_passwordform(dialog, 'Set values:', 12, 40, 3, form, insecure=.true., \u0026\n                         ok_label='Submit', title='Password Form')\ncall dialog_read(dialog, uuid)\ncall dialog_read(dialog, password)\ncall dialog_close(dialog)\n\nprint '(\"UUID:     \", a)', trim(uuid)\nprint '(\"Password: \", a)', trim(password)\n```\n\n### pause\n\n```fortran\ninteger :: stat\n\ncall dialog_pause('System reboots in 30 seconds.', 8, 36, 30, \u0026\n                  title='Pause', exit_stat=stat)\n\nselect case (stat)\n    case (DIALOG_YES)\n        print '(\"You pressed OK.\")'\n    case (DIALOG_NO)\n        print '(\"You pressed Cancel.\")'\n    case default\n        print '(\"You pressed Escape.\")'\nend select\n```\n\n### prgbox\n\n```fortran\ncall dialog_prgbox('Uptime:', 'uptime', 8, 64, title='Prg Box')\n```\n\n### programbox\n\n```fortran\ncharacter, parameter :: NL = new_line('a')\n\ncall dialog_programbox(dialog, 'Output:', 12, 32, title='Program Box')\ncall dialog_write(dialog, 'zzz ...' // NL)\ncall dialog_write(dialog, 'zzz ...' // NL)\ncall dialog_write(dialog, 'zzz ...' // NL)\ncall dialog_close(dialog)\n```\n\n### progressbox\n\n```fortran\ncharacter, parameter :: NL = new_line('a')\n\ncall dialog_progressbox(dialog, 'Output:', 12, 32, title='Progress Box')\ncall dialog_write(dialog, 'zzz ...' // NL)\ncall dialog_write(dialog, 'zzz ...' // NL)\ncall dialog_write(dialog, 'zzz ...' // NL)\ncall dialog_close(dialog)\n```\n\n### radiolist\n\n```fortran\ncharacter(len=32) :: selected\ntype(dialog_type) :: dialog\ntype(list_type)   :: list(3)\n\nlist(1) = list_type('item1', 'List Item 1', 'on')\nlist(2) = list_type('item2', 'List Item 2')\nlist(3) = list_type('item3', 'List Item 3')\n\ncall dialog_radiolist(dialog, 'Select items:', 16, 40, 5, list, \u0026\n                      title='Radio List')\ncall dialog_read(dialog, selected)\ncall dialog_close(dialog)\n\nprint '(\"Selected item: \", a)', trim(selected)\n```\n\n### rangebox\n\n```fortran\ncharacter(len=3)  :: range\ntype(dialog_type) :: dialog\n\ncall dialog_rangebox(dialog, 'Select range with PGUP/PGDOWN:', 7, 32, min_value=0, \u0026\n                     max_value=42, default_value=21, title='Range Box')\ncall dialog_read(dialog, range)\ncall dialog_close(dialog)\n\nprint '(\"Selected range: \", a)', range\n```\n\n### tailbox\n\n```fortran\ncall dialog_tailbox('/var/log/messages', 18, 72, title='Tail Box')\n```\n\n### textbox\n\n```fortran\ncall dialog_textbox('./examples/wumpus.f90', 18, 72, title='Text Box')\n```\n\n### timebox\n\n```fortran\ncharacter(len=8)  :: time\ntype(dialog_type) :: dialog\n\ncall dialog_inputbox(dialog, 'Enter time:', 7, 32, hour=12, minute=0, second=0, \u0026\n                     title='Time')\ncall dialog_read(dialog, time)\ncall dialog_close(dialog)\n\nprint '(\"Time: \", a)', time\n```\n\n### treeview\n\n```fortran\ncharacter(len=32) :: selected\ntype(dialog_type) :: dialog\ntype(tree_type)   :: tree(4)\n\ntree(1) = tree_type('tag1', 'one',   'off', 0)\ntree(2) = tree_type('tag2', 'two',   'off', 1)\ntree(3) = tree_type('tag3', 'three', 'on',  2)\ntree(4) = tree_type('tag4', 'four',  'off', 1)\n\ncall dialog_treeview(dialog, 'Select item:', 0, 0, 0, tree, title='Tree View')\ncall dialog_read(dialog, selected)\ncall dialog_close(dialog)\n\nprint '(\"Selected: \", a)', trim(selected)\n```\n\n### yesno\n\n```fortran\ninteger :: answer\n\nanswer = dialog_yesno('Please press Yes or No!', 6, 30, title='Example')\n\nselect case (answer)\n    case (DIALOG_YES)\n        print '(\"You pressed Yes.\")'\n    case (DIALOG_NO)\n        print '(\"You pressed No.\")'\n    case default\n        print '(\"You pressed Escape.\")'\nend select\n```\n\n## Themes\n\nYou can create a new *dialog(1)* theme via:\n\n```\n$ dialog --create-rc ~/.dialogrc\n```\n\nAlter the settings to your liking. In `/usr/local/share/examples/dialog/`,\nyou find several pre-defined themes:\n\n* `debian.rc`\n* `slackware.rc`\n* `sourcemage.rc`\n* `suse.rc`\n* `whiptail.rc`\n\nCopy one of the widget styles to `~/.dialogrc`.\n\n## Compatiblity\n\n* Single quotes should be avoided, as they have to be escaped as `\"'\\''\"` in any\n  text passed to *dialog(1)* from Fortran.\n* Only the wrapper function `dialog_yesno()` and subroutines with optional dummy\n  argument `exit_stat` return the exit status of *dialog(1)*. The routine\n  `dialog_close()` returns an optional exit status.\n* Dialog proceeding (`--and-widget`) is not supported.\n\n## Licence\n\nISC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterkosmos%2Ffortran-dialog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterkosmos%2Ffortran-dialog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterkosmos%2Ffortran-dialog/lists"}