From 175529712bba41ba0db09fea44ed4d568452ae8f Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 26 Oct 2015 15:24:06 +0100 Subject: Fixed errors and a warning Errors were caused by GTable returning NULL when the index is set to NA. Tried to avoid this by adapting GTable$set_index() but I did not get it right. --- inst/GUI/gmkin.R | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/inst/GUI/gmkin.R b/inst/GUI/gmkin.R index 72631b8..66e1515 100644 --- a/inst/GUI/gmkin.R +++ b/inst/GUI/gmkin.R @@ -213,7 +213,9 @@ ds.switcher <- function(h, ...) { update_ds_editor() ds.delete$call_Ext("enable") ds.copy$call_Ext("enable") - if (!is.na(svalue(m.gtable))) f.conf$call_Ext("enable") + if (!is.null(svalue(m.gtable, index = TRUE))) { + if (!is.na(svalue(m.gtable))) f.conf$call_Ext("enable") + } svalue(center) <- 2 svalue(right) <- 2 } @@ -227,7 +229,9 @@ m.switcher <- function(h, ...) { update_m_editor() m.delete$call_Ext("enable") m.copy$call_Ext("enable") - if (!is.na(svalue(ds.gtable))) f.conf$call_Ext("enable") + if (!is.null(svalue(ds.gtable, index = TRUE))) { + if (!is.na(svalue(ds.gtable))) f.conf$call_Ext("enable") + } svalue(center) <- 3 svalue(right) <- 3 } @@ -247,8 +251,10 @@ f.switcher <- function(h, ...) { c.m$call_Ext("setText", paste0("", ftmp$mkinmod$name, ""), FALSE) f.conf$call_Ext("disable") - ds.gtable$clear_selection() - m.gtable$clear_selection() + + ds.gtable$set_index(NA) + m.gtable$set_index(NA) + show.initial.gb.o$call_Ext("enable") update_f_conf() show_plot("Optimised") @@ -1096,7 +1102,7 @@ plot_ftmp <- function() { if (length(svalue(f.gg.po.obssel)) == 0) { gmessage("Please select more than one variable for plotting.") } else { - if(svalue(f.gg.po.obssel) != "") { + if(svalue(f.gg.po.obssel)[1] != "") { obs_vars_plot = svalue(f.gg.po.obssel) } else { obs_vars_plot = names(ftmp$mkinmod$spec) -- cgit v1.2.1