SciViews / svDialogs

Standard Dialog Boxes for R
https://www.sciviews.org/svDialogs/
Other
8 stars 1 forks source link

Adjust window size with dlg_list #10

Closed singla closed 3 years ago

singla commented 3 years ago

Hi, I am using below code to generate a dialog box with list dlg_list(c("monthly","quarterly"), multiple=FALSE,title="Please specify the input frequency")

In this case, dialog box appears fine but the title gets cut as the width of window does not get adjusted. Is there a way to do that? I am using R 3.6.3 , R studio 1.4 Thanks, Urvashi

phgrosjean commented 3 years ago

svDialogs uses different backends, depending on the context. Are you running R under Windows, MacOS, or Linux? On my Mac, or on Ubuntu, the Tcl/Tk window that is used adjusts the width of the window automatically to the title size. On Windows, it its the select.list() function that is used to display the dialog box. That function adapts the width of the dialog box to the content of the list but apparently not to the size of the title. There is little I can do on my side in svDialogs and if this is the problem, I would suggest to report this to the R Core Team related to select.list() with this code:

select.list(c("monthly", "quarterly"), multiple = FALSE, title = "Please specify the input frequency")

In the meantime, a temporary solution would be to make the content of the list wider artificially. Something like this would do the job, but I agree that it is a bad workaround:

sel <- dlg_list(c("monthly ","quarterly"), multiple=FALSE,title="Please specify the input frequency") trimws(sel$res)

(well, in the message, the spaces after "monthly" have been shortened, but the idea is to put enough of them to reveal the title completely by stretching the window)

singla commented 3 years ago

Thank you!. The workaround works fine.

phgrosjean commented 3 years ago

Fine!