Sorry to bug again, but I'm hitting a stumbling block again. I'm using a custom TreeModel based on CustomList.d from the demo, and while it's working fine put into a TreeView, I'm having some weird OS-specific problems when I put it into a ComboBox
On Windows, the popup seems to work unless I use setWrapWidth, in which case I get a blank single-pixel popup.
On Linux, it's the same if I use setWrapWidth, but if I don't use setWrapWidth, the popup is still blank, but full width.
I'm able to reproduce the behavior with a small change to DemoCustomList.d:
module DemoCostumList;
import CustomList;
import glib.RandG;
import gtk.Main;
import gtk.ScrolledWindow;
import gtk.MainWindow;
import gtk.TreeView;
import gtk.TreeViewColumn;
import gtk.CellRendererText;
import gtk.ListStore;
import gtk.ComboBox;
class CustomListWindow : MainWindow
{
this()
{
super("GtkD - Custom TreeModel");
setDefaultSize(200, 400);
ScrolledWindow scrollwin = new ScrolledWindow();
ComboBox view = createViewAndModel();
scrollwin.add(view);
add(scrollwin);
showAll();
}
ComboBox createViewAndModel()
{
TreeViewColumn col;
CellRendererText renderer;
CustomList customlist;
//TreeView view;
ComboBox view;
customlist = new CustomList();
fillModel(customlist);
//view = new TreeView(customlist);
view = new ComboBox(customlist);
//col = new TreeViewColumn();
renderer = new CellRendererText();
view.packStart(renderer, true);
//col.addAttribute(renderer, "text", CustomListColumn.Name);
//col.setTitle("Name");
// view.appendColumn(col);
// col = new TreeViewColumn();
renderer = new CellRendererText();
view.packStart(renderer, true);
// col.addAttribute(renderer, "text", CustomListColumn.YearBorn);
// col.setTitle("Year Born");
// view.appendColumn(col);
return view;
}
void fillModel (CustomList customlist)
{
string[] firstnames = [ "Joe", "Jane", "William", "Hannibal", "Timothy", "Gargamel" ];
string[] surnames = [ "Grokowich", "Twitch", "Borheimer", "Bork" ];
foreach (sname; surnames)
{
foreach (fname; firstnames)
{
customlist.appendRecord(fname ~" "~ sname, 1900 + (RandG.randomInt() % 100));
}
}
}
}
void main (string[] arg)
{
Main.init(arg);
new CustomListWindow();
Main.run();
}
This is on the GTK2 branch, if that affects anything.