Ronggui / RQDA

R-based Qualitative Data Analysis
http://rqda.r-forge.r-project.org
Other
113 stars 31 forks source link

Improve usability: remove the OK button of Settings tab #7

Open jalvesaq opened 8 years ago

jalvesaq commented 8 years ago

When the access to the parent window is blocked until the client window is closed, it is impossible to continue working in the parent window unless we click in either an "OK" or a "Cancel" button. However, this is not the case of the Settings widget, and I frequently forget to press the OK button after changing the Type of Retrieval. So, I suggest that the OK button is removed and that user changes take effect immediately. The diff below shows a way of achieving this:

diff --git a/R/Setting.R b/R/Setting.R
index 5f0568d..113a26c 100644
--- a/R/Setting.R
+++ b/R/Setting.R
@@ -67,13 +67,22 @@ addSettingGUI <- function(container,width=12){
   ButtonContainer <- ggroup(container = container) ##, width=100) ## not necessary to set width here
   addSpring(ButtonContainer)
   resetButton <- gbutton("Default", container = ButtonContainer)
-  okButton <- gbutton("OK", container = ButtonContainer)

-  addHandlerChanged(okButton, function(h,...) {
+  GetSettings <- function(...){
     out <- svalue(SettingFL)
     tryCatch(ClearMark(.rqda$.root_edit,0,nchar(svalue(.rqda$.openfile_gui)),TRUE,TRUE),error=function(e){})
     for (i in names(out)) assign(i,out[[i]],envir=.rqda)
-  })
+  }
+
+  addHandlerKeystroke(SettingFL[]$encoding, GetSettings)
+  addHandlerKeystroke(SettingFL[]$owner, GetSettings)
+  addHandlerChanged(SettingFL[]$BOM, GetSettings)
+  addHandlerChanged(SettingFL[]$SFP, GetSettings)
+  addHandlerChanged(SettingFL[]$encoding, GetSettings)
+  addHandlerChanged(SettingFL[]$back.col, GetSettings)
+  addHandlerChanged(SettingFL[]$fore.col, GetSettings)
+  addHandlerChanged(SettingFL[]$codingTable, GetSettings)
+  addHandlerChanged(SettingFL[]$TOR, GetSettings)

   addHandlerChanged(resetButton, function(h,...) {
     tryCatch(ClearMark(.rqda$.root_edit,0,nchar(svalue(.rqda$.openfile_gui)),TRUE,TRUE),error=function(e){})