Hey there,
We can create a new entry in LibUI via:
Then, we can set it read-only, via:
LibUI.entry_set_read_only
LibUI.entry_set_read_only(entry, 1) # so 1 means true, aka yes, aka "yes, make this entry read-only".
However had the 1 there is awkward. I assume in C we work with 0 and 1 rather than false and
true, correspondingly. So this part I can understand. C expects 0 or 1 - no problem there.
My question is, though: could we modify this to also allow true and false values, from within ruby? Such
that this API is also possible:
LibUI.entry_set_read_only(entry, true)
I don't know enough about C and fiddle to understand whether this is feasible, but I think when working
with ruby, it is nicer to stay "within" thinking about ruby (e. g. true and false, rather than 0 or 1.
In my gem libui_paradise this is not a problem because I use helper methods, such as:
entry = create_entry
entry.readonly
So I don't even pass 1 or 0 directly, when writing code for GUIs. But in "raw" libui, it is a bit
awkward to have to use 0 and 1. ("raw" libui is, in this context, examples with working ruby-libui
code where I do not use any external dependencies. I distribute both standalone-examples as
well as non-standalone examples; the reason for providing standalone examples is so that other
people can learn from these examples; but also as some kind of weak "test suite" so I can ensure
things work fine with the "raw" libui bindings, rather than me making a mistake with add-on
helper code that I wrote, and may be buggy).
Anyway. This is not so much an issue request for any change; I am more interested if this were
possible, in theory. Perhaps I should ask kou - he knows everything. :)
Please feel free to close this issue at your leisure.
Hey there,
We can create a new entry in LibUI via:
Then, we can set it read-only, via:
However had the 1 there is awkward. I assume in C we work with 0 and 1 rather than false and
true, correspondingly. So this part I can understand. C expects 0 or 1 - no problem there.
My question is, though: could we modify this to also allow true and false values, from within ruby? Such
that this API is also possible:
I don't know enough about C and fiddle to understand whether this is feasible, but I think when working
with ruby, it is nicer to stay "within" thinking about ruby (e. g. true and false, rather than 0 or 1.
In my gem libui_paradise this is not a problem because I use helper methods, such as:
entry = create_entry
entry.readonly
So I don't even pass 1 or 0 directly, when writing code for GUIs. But in "raw" libui, it is a bit
awkward to have to use 0 and 1. ("raw" libui is, in this context, examples with working ruby-libui
code where I do not use any external dependencies. I distribute both standalone-examples as
well as non-standalone examples; the reason for providing standalone examples is so that other
people can learn from these examples; but also as some kind of weak "test suite" so I can ensure
things work fine with the "raw" libui bindings, rather than me making a mistake with add-on
helper code that I wrote, and may be buggy).
Anyway. This is not so much an issue request for any change; I am more interested if this were
possible, in theory. Perhaps I should ask kou - he knows everything. :)
Please feel free to close this issue at your leisure.