bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dialog enhance fselect / dselect


From: Tiago Teixeira
Subject: Re: Dialog enhance fselect / dselect
Date: Sat, 16 Nov 2019 15:47:17 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0


On 16/11/19 15:14, Thomas Dickey wrote:
On Wed, Nov 13, 2019 at 04:47:40PM +0000, address@hidden wrote:
Good afternoon,

While using dialog, when prompting to select a folder, I noticed the
"Directories"/"Files" is not changeable, which I kinda needed to be.
"kinda" is vague - it might be nice to know what problem is solved.


In this program I'm writing, I'm prompting the user 3-4 times for a directory, each time for a different purpose, and all in a row (ask for backend source directory, frontend source directory, etc ...).


The dselect dialog (and fselect, same function deep down), simply shows a "gui" with a pure directory selection, that is, (the dialog title,) a "subtitle" or text saying "Directories" or "Files" and then the actual directory selection below - current directory listing and current selection.


To ask the user 3-4 times for a directory selection, I currently have to show, before each 'dselect', another dialog (infobox/msgbox) to tell the user what the selection will be for.


So I thought it would be nice if that "Directories"/"Files" text could be changed.


I noticed fselect/dselect takes 4 parameters, with a 5th optional parameter
(which seemed unused), so I took advantage of that to make that 5th argument
the prompt.
you could add a new function which does this, but changing an existing
function won't work for me.


I tried to make the change minimal.


You can see, in the file 'dialog.c', in the modes[] array, (around) line 1249, the dselect and at line 1251 the fselect, both modes take a minimum of 4 parameters, and a maximum of 5.


That 5th parameter is not being used anywhere (refer to line 922 - call_dselect and line 942 - call_fselect).


I "took advantage" of that 5th parameter and added one last parameter 'char* prompt' to some functions (dialog_dselect, dialog_fselect and dlg_fselect) to, inside dlg_select, if that prompt string is defined ( not NULL ), use it instead of "Directories" or "Files".


This doesn't break anything, compilation runs smooth and usage is the same.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]