0

gWidgets と RGtk2 を使用して GUI を作成しました。GUI の一部は、gcomboboxes のセットを含むグレイアウトです。これらのボックスは最初は空で、ファイルがインポートされると入力されます。

X11 を介して実行されている Gtk+ を使用する Mac では、コンボボックスの幅が、コンボボックス内の最長のテキスト文字列に合わせてサイズ変更されます。Windows ではこれは起こらず、コンボボックスは長いテキスト文字列に対応するためにスクロールバーを取得します (写真を参照)。

Windows のコンボボックス

Mac のコンボボックス

再描画を強制するために可視性のオフとオンを切り替えてみましたが、サイズは固定されたままです。

Windowsマシンでサイズ変更を強制する方法はありますか?

関連するウィジェットを保持するコンテナーのコードは次のとおりです。

optionsBox <- ggroup(cont=controlGroup)
addSpring(optionsBox)
options <- glayout(cont=optionsBox, spacing=5, fill='y')
optList <- list()
options[1, 1, anchor=c(1,0)] <- 'Category:'
options[1, 2, anchor=c(-1,0)] <- optList$category <- gcombobox(category, cont=options)
options[2, 1, anchor=c(1,0)] <- 'Order:'
options[2, 2, anchor=c(-1,0)] <- optList$order <- gcombobox(order, cont=options)
options[2, 3, anchor=c(1,0)] <- optList$numeric <- gcheckbox('numeric', checked=TRUE)
options[3, 1, anchor=c(1,0)] <- 'Plottype:'
options[3, 2, anchor=c(-1,0)] <- optList$plottype <- gcombobox(c('Bar', 'Line'), cont=options)
addSpring(optionsBox)

幸運をお祈りしています

トーマス

4

1 に答える 1

2

これを Windows で簡単にテストすることはできませんが、いくつかのことが役立つはずです。まず、glayoutオブジェクトの親コンテナーが初期サイズを制限していないことを確認してください。(以下の例では、何が起こるかを確認するために設定を試しdo_expand=FALSEてください。)メソッドでウィジェットのサイズを設定しない限りsize<-(最善の使用法ではありませんが、時にはできることもあります)、初期サイズは、ウィジェットのサイズ要求を満たすことから得られます。 .

library(gWidgets)
options(guiToolkit="RGtk2")
w <- gwindow()
g <- ggroup(cont=w)
do_expand=TRUE
options <- glayout(cont=g, spacing=5, expand=do_expand)
items <- ""

options[1,1] = "vanilla"
options[1,2] <- gcombobox(items, cont=options)

options[2,1] = "expand"
options[2,2, expand=TRUE] <- gcombobox(items, cont=options)

options[3,1] = "expand, fill"
options[3,2, expand=TRUE, fill="y"] <- gcombobox(items, cont=options)

options[4,1] = "size"
options[4,2] <- (cb <- gcombobox(items, cont=options))
size(cb) <- c(250, -1)

## populate comboboxes 
items <- state.name 
sapply(options[,2], function(i) i[] <- items)
于 2012-10-15T12:49:18.533 に答える