-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Examples: could an example be added for LibUI.new_scrolling_area? #42
Comments
I found it works on kotlin: https://nicedoc.io/msink/kotlin-libui Screenshot: Guess now the key is to understand the kotlin code. :) If it works then perhaps it could be added towards control_gallery.rb ? Since the latter already |
I think The kotlin example you gave is just a multiline_entry.
I think what you really want is Table or append/delete of hbox. |
In Ruby/Tk, you can use BWidget in this way. require 'tk'
require 'tkextlib/bwidget'
root = TkRoot.new
sw = Tk::BWidget::ScrolledWindow.new(root)
sf = Tk::BWidget::ScrollableFrame.new(sw, constrainedwidth: true)
sw.set_widget(sf)
vf = sf.get_frame
vf.configure(bg: :white, borderwidth: 1, relief: :groove)
10.times do |i|
TkButton.new(vf, text: "button #{i}").pack
TkLabel.new(vf, text: "label #{i}").pack
end
sw.pack(fill: :both, expand: true)
Tk.mainloop |
I already provide an Ruby example of (sorry, I didn't see this issue before as I was very busy with other stuff the last two months and had unwatched LibUI except for releases to keep myself focused on my tasks, but I just re-enabled full watching of LibUI to stay informed of issues in case I could help) Code: https://github.com/AndyObtiva/glimmer-dsl-libui/blob/master/examples/basic_scrolling_area.rb BTW, you can only control the scrolling programmatically on Mac, but not Windows and Linux (seems like a bug in C libui). But, you can still scroll the area manually on all platforms at least. Otherwise, you cannot put anything in a scrolling area (like labels and buttons), yet only area content like path shapes. That said, by building area-based custom controls, you can then add your own (custom) flavors of label and button inside a scrolling area, and thus achieve your goal anyways. If you need help in programming your app with Cheers! |
Hello kojix2 and everyone else,
Would it be possible to add a small example for how LibUI.new_scrolling_area
works?
Use case:
Actually I wrote a tiny ruby-gtk3 application that uses mpv to play local .mp3 files.
This is in a scrolled window, with a vbox, containing each local song via a button.
So I click on the button and then mpv plays the song. This is like the ultimate
minimal "jukebox".
On windows I tested - ffmpeg works, mpv works, libui works too.
And using the buttons works as well, but I'd like them in some scrolling container.
Unfortunately I have not yet managed to make this work. I'll google more to see
if I can find an example via scrolling-area, or perhaps I figure it out on my own
eventually. (The malloc and fiddle parts are over my head unfortunately ... I
should have started with C really ... )
At any rate as always please feel free to close the issue request at any moment
in time how you see fit. I also used glimmer-dsl-libui recently to embed images
into a "libui"-widget (on windows), that works too. I got some weird problems
though related to my own ruby code ... would be cool if fiddle-pointer stuff
could get better support for traceback problems. I kind of miss the introspection
you get with ruby methods. :(
The text was updated successfully, but these errors were encountered: