Hello there,
now that I started with gwidgets, I'll have several question (I hope not too
stupid ones).
I've started with a little application which uses a gpanedgroup to show a gtree
at the left side and something else on the other side.
Gtree works fine except the fact that it produces 3 columns though my offspring
function returns a data.frame with 1 column only (two columns then remain
without content).
Is there any way to delete these columns?
And another question:
If I expand my folders in the gtree and go deeper into the file structure, it
happens that the filenames are not displayed fully anymore because of too less
space. Can I make the gtree automatically horizontal scrollable (it can be
scrolled if I push the columns to a certain width).
Thanks a lot for any help!
Antje
The code:
# methods to update the file tree
# ------------------------------------------------
offspring <- function(path, user.data=NULL) {
if(length(path) > 0)
directory <- paste(getwd(),"/",paste(path,
collapse="/"),sep="",collapse="")
else
directory <- getwd()
files <- data.frame(dir(path=directory))
rownames(files) <- dir(path=directory, full.names = TRUE)
names(files)[1] <- "Files and Folders"
return(files)
}
hasOffspring <- function(children,user.data=NULL, ...) {
return(file.info(rownames(children))$isdir)
}
icon.FUN <- function(children,user.data=NULL, ...) {
info <- file.info(rownames(children))
x <- rep("file", length=nrow(children))
x[info$isdir] <- "directory"
return(x)
}
# ------------------------------------------------
# application
# ------------------------------------------------
mainwin <- gwindow(title = "TestApplication", visible = TRUE, name=title)
pg <- gpanedgroup(container = mainwin)
gtree(offspring, hasOffspring, icon.FUN = icon.FUN, container=pg)
gtext(cont = pg)
svalue(pg) <- 0.4
# ------------------------------------------------
[R-gui] gtree question
8 messages · Antje, Michael Lawrence, j verzani +1 more
Antje <niederlein-rstat <at> yahoo.de> writes: Dear Antje,
Hello there, now that I started with gwidgets, I'll have several question ( I hope not too stupid ones). I've started with a little application which uses a gpanedgroup to show a gtree at the left side and something else on the other side. Gtree works fine except the fact that it produces 3 columns though my offspring function returns a data.frame with 1 column only (two columns then remain without content). Is there any way to delete these columns?
Thanks for pointing out this issue. I fixed it in a just-uploaded version of gWidgetstcltk and I also found an issue with gWidgetsRGtk2 with your example. Again, this is just fixed. The bug was the number of extra columns was set by the number of words in your column title. In the new version, there is just one extra column and it has a small width.
And another question: If I expand my folders in the gtree and go deeper into the file structure, it happens that the filenames are not displayed fully anymore because of too less space. Can I make the gtree automatically horizontal scrollable (it can be scrolled if I push the columns to a certain width).
I don't have that coded in but can look into it.
Thanks a lot for any help! Antje
Thanks for the report. --JOhn --code is cut --
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-gui/attachments/20080807/ffe00d45/attachment.pl>
Michael Lawrence <mflawren <at> fhcrc.org> writes:
On Thu, Aug 7, 2008 at 12:32 PM, john verzani <jverzani <at> gmail.com> wrote:
Antje <niederlein-rstat <at> yahoo.de> writes: Dear Antje,
Michael is right. There are other ways to include a file chooser, especially in
RGtk2. I think Antje was using the tcltk version though. Anyways, here are some
ways:
gfile() will open a dialog
gfilebrowse() adds a button to initiate the dialog
or as Michael points out, one can put in a RGtk2 object into gWidgets via the
add method:
w <- ggroup("test")
g <- ggroup(cont = w)
add(g, gtkButton("new button")
but this isn't working directly for some reason with the file chooser widget.
But putting into an intermediate Hbox works:
g <- ggroup(cont = T)
fc <- gtkFileChooserWidgetNew("GTK_FILE_ACTION_SAVE")
g1 <- gtkHBox(); g1$Add(fc)
add(g, g1, expand=TRUE)
--John
On Fri, Aug 8, 2008 at 7:20 AM, john verzani <jverzani at gmail.com> wrote:
or as Michael points out, one can put in a RGtk2 object into gWidgets via the
add method:
w <- ggroup("test")
g <- ggroup(cont = w)
add(g, gtkButton("new button")
Is that documented anywhere? I had no idea you could mix gWidgets with RGtk2 widgets.
Felix Andrews / ??? PhD candidate Integrated Catchment Assessment and Management Centre The Fenner School of Environment and Society The Australian National University (Building 48A), ACT 0200 Beijing Bag, Locked Bag 40, Kingston ACT 2604 http://www.neurofractal.org/felix/ 3358 543D AAC6 22C2 D336 80D9 360B 72DD 3E4C F5D8
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-gui/attachments/20080807/cec69735/attachment.pl>
Felix Andrews <felix <at> nfrac.org> writes:
On Fri, Aug 8, 2008 at 7:20 AM, john verzani <jverzani <at> gmail.com> wrote:
or as Michael points out, one can put in a RGtk2 object into gWidgets via the
add method:
w <- ggroup("test")
g <- ggroup(cont = w)
add(g, gtkButton("new button")
Is that documented anywhere? I had no idea you could mix gWidgets with RGtk2 widgets.
Hi, well I thought I had it written down somewhere, but can't seem to find it.
In addition to add, the as.gWidgetsRGtk2 method can be used to coerce some RGtk2
widgets into gWidgsts so that one can use the gWidgets methods:
b = gtkButton("click me")
b1 = as.gWidgetsRGtk2(b)
svalue(b1)
[1] "click me"
Also, onc can also add a gWidgetsRGtk2 object to an RGtk2 container with
getToolkitWidget, as follows:
w = gtkWindow()
b = gbutton("button")
w$Add(getToolkitWidget(b))
As Michael points out, this usage is only for RGtk2. The tcltk implementation
doesn't allow it.
--JOhn
Hi John, thanks a lot for your help! A very stupid question left - where can I find the updated version of the gWidgetstcltk package? A general comment to the file chooser dialog suggestion: Due to the fact that I want to handle directories OR files in my application - a file chooser would not really help me. I'd like to have an application where people can select a directory and do some processing with all files of a special file type below or that people can select this file type directly. Further, the tool should support the functionality of a commercial application which provides this kind of layout too. So it should be much more intuitive for the user to navigate within familiar structures :-) Antje john verzani schrieb:
Antje <niederlein-rstat <at> yahoo.de> writes: Dear Antje,
Hello there, now that I started with gwidgets, I'll have several question ( I hope not too stupid ones). I've started with a little application which uses a gpanedgroup to show a gtree at the left side and something else on the other side. Gtree works fine except the fact that it produces 3 columns though my offspring function returns a data.frame with 1 column only (two columns then remain without content). Is there any way to delete these columns?
Thanks for pointing out this issue. I fixed it in a just-uploaded version of gWidgetstcltk and I also found an issue with gWidgetsRGtk2 with your example. Again, this is just fixed. The bug was the number of extra columns was set by the number of words in your column title. In the new version, there is just one extra column and it has a small width.
And another question: If I expand my folders in the gtree and go deeper into the file structure, it happens that the filenames are not displayed fully anymore because of too less space. Can I make the gtree automatically horizontal scrollable (it can be scrolled if I push the columns to a certain width).
I don't have that coded in but can look into it.
Thanks a lot for any help! Antje
Thanks for the report. --JOhn --code is cut --
_______________________________________________ R-SIG-GUI mailing list R-SIG-GUI at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-gui