Skip to content

[R-gui] tutorial on gwidgets?

3 messages · Antje, Michael Lawrence, j verzani

#
Hi Tamas,

thanks a lot for your answer.
These tutorials I already found but still I don't know how to create a flexible 
layout. For example (simple one), I'd like to have a window with a text field 
with fixed width on the one side (stretched over the whole height) and on the 
remaining right side, I'd like to put a button with a fixed height but width 
adjustet to the remaining space of the window.

This code would not give me the layout I'd like to see and I don't know how to 
do it (even with the tutorials mentioned)

<pre>
mainwin <- gwindow(title = "TestApplication", visible = TRUE, name=title)
splitgroup <- ggroup(horizontal=TRUE, container=mainwin)

gtext(text = "Here we go", width = 150, container=splitgroup)
gbutton("push me", container = splitgroup, expand = TRUE)
size(mainwin) <- c(500,500)
</pre>

I don't even know if there is any way to do what I want...

Antje
#
Dear Tamas and Michael,

Michael Lawrence <mflawren <at> fhcrc.org> writes:
SO far that's the documentation. I hope sometime to improve on it, but keep
getting distracted. The latest one was gWidgetsWWW. My todo list for gWidgets is
to rewrite the Rd files to better specify the API.  The comment about R-wiki
being way out of date is likely true. I haven't put any efforts into keeping
that up.
The buttons in RGtk2 always expand in one direction. To prevent that, a kludge
is to place them in a group as Michael says. If you really want a horizontal
group, you can nest groups:


mainwin <- gwindow(title = "TestApplication 2", visible = TRUE, name=title)
splitgroup <- ggroup(horizontal=TRUE, container=mainwin)

gtext(text = "Here we go", width = 150, container=splitgroup)
g = ggroup(horizontal=FALSE, expand=FALSE,container = splitgroup)
gbutton("push me", container = g)
size(mainwin) <- c(500,500)
Ughh, they should. I added the ability to specify an alignment via anchor but
instead of centering the buttons by default I mistakenly placed them high and
inside (to a right handed batter). I'll upload a fix today. Thanks for pointing
it out.

[to see, try:
w <- gwindow("test of centered")
g <- ggroup(horizontal=FALSE, cont=w)
b1 <- gbutton("centered? Oops!", cont=g, expand=TRUE)
b2 <- gbutton("centered? Should be", cont=g, anchor= c(0,0), expand=TRUE)

]

--John