~theclapp


#159 widget.Enum.Changed() can return true even if nothing has changed a month ago

Comment by ~theclapp on ~eliasnaur/gio

Thanks!

#159 widget.Enum.Changed() can return true even if nothing has changed a month ago

Ticket created by ~theclapp on ~eliasnaur/gio

If you click a radio button, widget.Enum.Changed() will return true. If you click the same button again, Changed() will return true again, even though nothing has actually changed.

#32 Sourcehut Pain Points 2 months ago

Comment by ~theclapp on ~eliasnaur/gio

~sircmpwn Thanks for the update!

#142 widget/editor.Move on an editor that hasn't been laid out yet panics 3 months ago

Comment by ~theclapp on ~eliasnaur/gio

Thanks!

#142 widget/editor.Move on an editor that hasn't been laid out yet panics 3 months ago

Ticket created by ~theclapp on ~eliasnaur/gio

If you call Move on an editor that hasn't been laid out yet, it panics, because editor.shaper is nil.

In my app, I have occasion to set the editor text, and move the caret to the end of the text (Move(len(text))), before having actually run Layout the first time.

#19 Add multiple top-level windows 4 months ago

Comment by ~theclapp on ~eliasnaur/gio

Thanks!

#96 Can't check the state of a checkbox w/out processing events 5 months ago

Comment by ~theclapp on ~eliasnaur/gio

Nice. Thanks!

#96 Can't check the state of a checkbox w/out processing events 5 months ago

Comment by ~theclapp on ~eliasnaur/gio

That looks like it'd work.

#96 Can't check the state of a checkbox w/out processing events 5 months ago

Comment by ~theclapp on ~eliasnaur/gio

Yeah, confirmed, this works:

func IsChecked(c widget.CheckBox) bool {
	return c.Checked(layout.NewContext(nil))
}

#96 Can't check the state of a checkbox w/out processing events 5 months ago

Comment by ~theclapp on ~eliasnaur/gio

use-case

I want to do something when the checkbox changes from unchecked to checked, or back again. Specifically, I have a list of checkboxes, and a "select all" checkbox, and when you click "select all" I want to set all the others to "checked", and when you click it again, I'd like to set all the others to "unchecked". Setting them all is not a hugely expensive operations, but on the other hand it's not something I want to do on every layout if I don't have to.

Button & RadioButton

I haven't used them in that way, but from checking the code, it looks like they'd have the same problem, yeah.

If I planned ahead and had a Context with an empty event queue, I guess I could use that instead. (But, ew.) Or if you changed the event processing code to allow for a nil Context, that could work too. (Less but non-zero ew.) If you exported the queue field of Context then I could copy my regular context and clear Queue right where I use it, which wouldn't require as much planning ahead.

Hmmm, actually typing that out and looking at the code some more, I guess I could do that regardless. My hurdle was the assumption that I'd want an otherwise identical Context, and to set the cfg correctly I'd have to have set up my alternate context in the main loop, but it looks like if I just want an empty event list (and don't care about cfg), I'm pretty sure I could just call NewContext(nil) and use that. That still seems suboptimal; since the checkbox knows its state, why can't I just query it, you know?