swh:1:snp:3a4bc456f1832b81cfa640941c632f6d5535d3a4
Raw File
Tip revision: cd86b08de1e3b03a04b7def69418a9e9a1b5a441 authored by R. Wayne Oldford on 16 March 2021, 21:40:03 UTC
version 1.3.4
Tip revision: cd86b08
l_subwin.R
#' @title Create a child widget path
#'   
#' @description This function is similar to \code{.Tk.subwin} except that does
#'   not the environment of the "tkwin" object to keep track of numbering the
#'   subwidgets. Instead it creates a widget path (parent).looni, where i is the
#'   smallest integer for which no widget exists yet.
#'   
#' @param parent parent widget path
#' @param name child name
#
#' @return widget path name as a string
#' 
#' @export
l_subwin <- function(parent, name="w") {
    if(is(parent,"tkwin")) {
        parent <- .Tk.ID(parent)
    }
    
    i <- 0
    child <- paste0(parent, '.', name)
    while(as.logical(tcl('winfo','exists', child))) {       
        i <- i + 1
        child <- paste0(parent, '.', name, i)        
    }
    
    return(child)
}
back to top