On 11/12/2015 08:20 PM, Gerald Nunn wrote:
I'm trying to get the Entry from a ComboBoxText as I need it to show text which is not in the list, calling setActiveText just sets the Entry to the first item. I tried the following code, but am getting a Seg Fault, on the cast to Entry, what am I doing wrong?
When I look at it with a debugger, widget looks like a valid object. The GTK docs say to use gtkbinget_child which is what the getChild is doing in Bin.d.
Widget widget = cbPath.getChild(); if (widget !is null) { Entry entry = cast(Entry) widget; entry.setText(dialog.getFilename()); }
As a workaround the following should work:
Widget widget = cbPath.getChild();
if (widget !is null) {
Entry entry = new Entry(widget.getWidgetStruct());
entry.setText(dialog.getFilename());
}