Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing bindings: Cannot read selected item of gtk.DropDown as string #88

Open
MJacred opened this issue Dec 16, 2022 · 4 comments
Open

Comments

@MJacred
Copy link

MJacred commented Dec 16, 2022

used auto-gen bindings: func (self *DropDown) SelectedItem() *coreglib.Object (docs)
what the object should be based on online comments: gtk.StringObject (docs)

note: could not find any filter that should exclude it (source)

the only workaround

  • store your string values in your code and then find them using func (self *DropDown) Selected() uint
    • requires same sorting

proposals
a) add binding for gtk.StringObject
b) do the magic internally and change return type of func (self *DropDown) SelectedItem() *coreglib.Object to the string value (rather dangerous, if item is in any custom case (depending on ListModel type) not a StringObject)

@diamondburned
Copy link
Owner

I think SelectedItem() returning *Object or Objector is correct. I'm not sure why there's no gtk.StringObject though?

@diamondburned
Copy link
Owner

If you want to try and find out, you can do GIR_VERBOSE=1 go generate |& /tmp/gir.out and grep 'StringObject' /tmp/gir.out.

@MJacred
Copy link
Author

MJacred commented Dec 17, 2022

I think SelectedItem() returning *Object or Objector is correct. I'm not sure why there's no gtk.StringObject though?

Yeah, no issue with return type, because it could be sth. else.

I also noticed that https://docs.gtk.org/gtk4/class.StringList.html has no bindings. Though right now I see no need for it, as the only func I've encountered so far that should take it as input param, will take []string instead in the bindings

If you want to try and find out, you can do GIR_VERBOSE=1 go generate |& /tmp/gir.out and grep 'StringObject' /tmp/gir.out.

My system is not set up for nix/docker, yet. I'll try to find some time next week to check it out and set it up

@MJacred
Copy link
Author

MJacred commented Dec 17, 2022

Ah, I forgot that my system is too old for gtk4. Upgrade is planned for January/early February.

So further investigating is not possible for me right now…

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

No branches or pull requests

2 participants