Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Editable Cell in TreeView #532

Closed
Kelvyn88 opened this issue Nov 22, 2020 · 4 comments
Closed

Editable Cell in TreeView #532

Kelvyn88 opened this issue Nov 22, 2020 · 4 comments

Comments

@Kelvyn88
Copy link

Does anybody know how to make a cell editable in a treeview?

I was available to set the editable property and works, but whem I press enter the value becomes the original.

Thanks

@tknopp
Copy link
Collaborator

tknopp commented Nov 22, 2020

I have done this for a ListStore / TreeView, here is the basic logic:

  store = ListStore(String,...)
  r = CellRendererText()
  set_gtk_property!(r, :editable, true)
  c = TreeViewColumn(col, r, Dict("text" => 0))
  G_.sort_column_id(c,0)
  G_.resizable(c,true)
  signal_connect(r, "edited") do widget, path, text
      # now you can do something with `string(text)`, which is the new text
  end

@Kelvyn88
Copy link
Author

Thanks!! It works!

@Kelvyn88
Copy link
Author

Kelvyn88 commented Dec 8, 2020

@tknopp a final question. How can I include a ComboBox to display values when editing a cell un the treeview. I know that the function CellRendererCombo exists but I couldn't find a code example.

@tknopp
Copy link
Collaborator

tknopp commented Dec 9, 2020

I have not used a CellRendererCombo before. Thus I cannot provide working code for that unfortunately.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants