Code Monkey home page Code Monkey logo

Comments (5)

rubyFeedback avatar rubyFeedback commented on June 10, 2024

I found it works on kotlin:

https://nicedoc.io/msink/kotlin-libui

Screenshot:

https://raw.githubusercontent.com/msink/kotlin-libui/master/samples/hello/hello-windows.png?sanitize=false

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
contains a LOT of demo-examples.

from libui.

kojix2 avatar kojix2 commented on June 10, 2024

Hi @rubyFeedback

I think LibUI.new_scrolling_area is to create an area with scroll bars. It is not a widget container.

The kotlin example you gave is just a multiline_entry.

I think what you really want is Table or append/delete of hbox.

from libui.

kojix2 avatar kojix2 commented on June 10, 2024

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

from libui.

kojix2 avatar kojix2 commented on June 10, 2024

andlabs/libui#178

from libui.

AndyObtiva avatar AndyObtiva commented on June 10, 2024

I already provide an Ruby example of scrolling_area in Glimmer DSL for LibUI

(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

scrolling area 1

scrolling area 2

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 scrolling_area, hit me up about it with an Issue request in Glimmer DSL for LibUI. I'd be happy to help you implement it.

Cheers!

from libui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.