Julia Gtk: How to get a list of properties for a widget?

Viewed 94

How do I go about getting a list of all properties for a widget in Julia Gtk?

1 Answers

Perhaps, you are looking for the properties that can be called with the get_gtk_property(aGtkEntryLeafObject, :someProperty, type) function and thus use the value of someProperty. I looked for possible hints everywhere. This is, in fact, very disappointing to see in how terribly sorry state the GTK documentations are still in. However, if so is the case, this might help:

When you run display(aGtkEntryLeafObject) you will get all the properties that can be summoned.

For example, I have a text entry box with which I take an input value. The ID of the entry box is iEntry. I wish to have the input value that has been put in the box.

display(glade["iEntry"])

Here the glade["iEntry"] is the GtkEntryLeaf object.

The output of the command is:

output of display(aGtkEntryLeaf)

Note that the text property is there, marked by yellow border in the picture. So I can summon the property using:

get_gtk_property(glade["iEntry"], :text, String);

output: "3.37e-3"

From the looks of it, I had to guess that the text property to be of String type. If mentioned otherwise it would have thrown an error. Now I have to parse this String type output for its use as a Float type just afterwards.

The things are also very similar if you have other type of controls, i.e., combo-box.

I have a combo-box for which the GladeEntryLeaf object is glade["conditionEntry"]. Here for the combo-box display(glade["conditionEntry"]) has the output:

output of display(aGtkComboboxEntryLeaf)

So from this output I can get the text,height-request, visible properties, among many other.

get_gtk_property(glade["conditionEntry"], :text, String)

output: "HWL"

get_gtk_property(glade["conditionEntry"], :visible, Bool)

output: true

get_gtk_property(glade["conditionEntry"], "height-request", Int)

output: -1

Note that some properties do not have any value and are Null.

Related