You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code on the Mac shows one area only (note the two disabled lines in the middle of the code).
require'libui'UI=LibUIUI.inithandler=UI::FFI::AreaHandler.mallochandler.to_ptr.free=Fiddle::RUBY_FREEarea=UI.new_area(handler)brush=UI::FFI::DrawBrush.mallocbrush.to_ptr.free=Fiddle::RUBY_FREEhandler_draw_event=Fiddle::Closure::BlockCaller.new(0,[1,1,1])do |_,_,area_draw_params|
path=UI.draw_new_path(0)UI.draw_path_add_rectangle(path,0,0,100,100)UI.draw_path_end(path)brush.Type=0brush.R=0.4brush.G=0.4brush.B=0.8brush.A=1.0area_draw_params=UI::FFI::AreaDrawParams.new(area_draw_params)UI.draw_fill(area_draw_params.Context,path,brush.to_ptr)UI.draw_free_path(path)endhandler.Draw=handler_draw_eventhandler.MouseEvent=Fiddle::Closure::BlockCaller.new(0,[0]){}handler.MouseCrossed=Fiddle::Closure::BlockCaller.new(0,[0]){}handler.DragBroken=Fiddle::Closure::BlockCaller.new(0,[0]){}handler.KeyEvent=Fiddle::Closure::BlockCaller.new(0,[0]){}box=UI.new_vertical_boxUI.box_set_padded(box,1)UI.box_append(box,area,1)handler2=UI::FFI::AreaHandler.mallochandler2.to_ptr.free=Fiddle::RUBY_FREEarea2=UI.new_area(handler2)brush2=UI::FFI::DrawBrush.mallocbrush2.to_ptr.free=Fiddle::RUBY_FREEhandler_draw_event2=Fiddle::Closure::BlockCaller.new(0,[1,1,1])do |_,_,area_draw_params|
path=UI.draw_new_path(0)UI.draw_path_add_rectangle(path,0,0,100,100)UI.draw_path_end(path)brush.Type=0brush.R=0.4brush.G=0.4brush.B=0.8brush.A=1.0area_draw_params=UI::FFI::AreaDrawParams.new(area_draw_params)UI.draw_fill(area_draw_params.Context,path,brush.to_ptr)UI.draw_free_path(path)endhandler2.Draw=handler_draw_event2handler2.MouseEvent=Fiddle::Closure::BlockCaller.new(0,[0]){}handler2.MouseCrossed=Fiddle::Closure::BlockCaller.new(0,[0]){}handler2.DragBroken=Fiddle::Closure::BlockCaller.new(0,[0]){}handler2.KeyEvent=Fiddle::Closure::BlockCaller.new(0,[0]){}box2=UI.new_vertical_boxUI.box_set_padded(box2,1)UI.box_append(box2,area2,1)# NOTE: Enable these two lines and area2 will show up# entry = UI.new_entry# UI.box_append(box2, entry, 1)grid=UI.new_gridUI.grid_append(grid,box,0,0,1,1,0,0,0,0)UI.grid_append(grid,box2,0,1,1,1,0,0,0,0)main_window=UI.new_window('Basic Area',400,400,1)UI.window_set_margined(main_window,1)UI.window_set_child(main_window,grid)UI.window_on_closing(main_window)doUI.control_destroy(main_window)UI.quit0endUI.control_show(main_window)UI.mainUI.quit
When enabling the two disabled lines, which add a control underneath the vertical box containing the second area, suddenly it shows up.
Not sure if this is an issue in LibUI (Ruby) or libui (C), so reporting...
BTW, I discovered this issue while building the GUI for Befunge98's Ruby implementation. You can see a screenshot of the Glimmer DSL for LibUI implementation at the bottom of the project README (gui branch under my fork). It basically constructs a grid of many area controls, capturing keyboard and mouse input from them and maintaining focus with a light gray color for the selected cell. At first, I tried building it with grid, but I encountered the issue above. I rewrote it using vertical_box and horizontal_boxs, and it worked!
Thanks for the report.
I actually had a chance to touch the Mac and confirmed that I can reproduce the problem.
But it may be difficult to determine the cause...
One thing I didn't mention before was that I originally tried the code without having intermediate vertical boxes between the grid and areas, and the same issue occured. I later added the vertical boxes as intermediaries hoping that would resolve the issue, but the issue persisted.
Thanks for confirming. I wonder if this needs to be reported to the C libui project.
This code on the Mac shows one area only (note the two disabled lines in the middle of the code).
When enabling the two disabled lines, which add a control underneath the vertical box containing the second area, suddenly it shows up.
Not sure if this is an issue in LibUI (Ruby) or libui (C), so reporting...
BTW, I discovered this issue while building the GUI for Befunge98's Ruby implementation. You can see a screenshot of the Glimmer DSL for LibUI implementation at the bottom of the project README (gui branch under my fork). It basically constructs a grid of many
area
controls, capturing keyboard and mouse input from them and maintaining focus with a light gray color for the selected cell. At first, I tried building it withgrid
, but I encountered the issue above. I rewrote it usingvertical_box
andhorizontal_box
s, and it worked!LibUI is awesome!
The text was updated successfully, but these errors were encountered: