jverzani / gWidgets2

Rewrite of gWidgets
35 stars 9 forks source link

`svalue(gpanedgroup_obj)` <- 0.25 fails in some cases #69

Closed landroni closed 10 years ago

landroni commented 10 years ago

The following feels like a bug:

w <- gwindow()
g <- gpanedgroup(cont=w)
svalue(g) <- 0.25
tbl <- gtable(names(mtcars), cont=g)
dg <- ggroup(cont=g)

I would have expected tbl to take 25% of the paned group (even if the 2nd part of the paned group contains only a ggroup), but it takes 100%. Is this expected behaviour?

This seems like a timing issue. If instead of the above I first execute:

w <- gwindow()
g <- gpanedgroup(cont=w)
tbl <- gtable(names(mtcars), cont=g)
dg <- ggroup(cont=g)

And then once the UI is up:

svalue(g) <- 0.25

Then it works. Is this something that can be fixed?

jverzani commented 10 years ago

Maybe if you call visible after setting up GUI. Usually a good idea, as it appears to render faster.

landroni commented 10 years ago

Indeed, this works:

w <- gwindow(visible=F)
g <- gpanedgroup(cont=w)
tbl <- gtable(names(mtcars), cont=g)
dg <- ggroup(cont=g)
visible(w) <- TRUE
svalue(g) <- 0.25

But still, the behaivor seems confusing (and has bitten me several times in the past). Why is this happening (i.e. svalue(g) <- 0.25 failing in some non-obvious cases)? And should this perhaps be documented somehow?

jverzani commented 10 years ago

The problem is that the 0.25 is based on the size of the widget. For some widgets, that is well determined until it is drawn. I'll add a not to the docs.

On Sun, Aug 3, 2014 at 3:19 AM, landroni notifications@github.com wrote:

Indeed, this works:

w <- gwindow(visible=F) g <- gpanedgroup(cont=w) tbl <- gtable(names(mtcars), cont=g) dg <- ggroup(cont=g) visible(w) <- TRUE svalue(g) <- 0.25

But still, the behaivor seems confusing (and has bitten me several times in the past). Why is this happening (i.e. svalue(g) <- 0.25 failing in some non-obvious cases)? And should this perhaps be documented somehow?

— Reply to this email directly or view it on GitHub https://github.com/jverzani/gWidgets2/issues/69#issuecomment-50983939.

John Verzani Chair, Department of Mathematics College of Staten Island, CUNY verzani@math.csi.cuny.edu

landroni commented 10 years ago

I see, thanks. Closing now.