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
{{ message }}
This repository was archived by the owner on May 24, 2025. It is now read-only.
Great project. I just started playing around with the Menu feature. I wanted to see how I could reuse the "next" & "prev" key commands to navigate different menus that appear in the same interface (like child menus that drill down as you make selections along the way). I quickly got the following code to work and wanted to see if there was a better approach that I'm missing. Is there a built-in way to get context for key triggers/events? Do you think that some kind of 'system of related menus' might be in vedeu's future?
class MenuApp
include Vedeu
Vedeu.menu 'game_menu' do
items [:game1, :game2, :game3]
end
Vedeu.menu 'help_menu' do
items [:help1, :help2, :help3]
end
event(:_initialize_) do
trigger(:show_game_menu)
end
event :show_help_menu do
@active_menu = 'help_menu'
HelpView.new.show
trigger(:_refresh_)
end
event :show_game_menu do
@active_menu = 'game_menu'
GameView.new.show
trigger(:_refresh_)
end
event :menu_prev_event do
trigger(:move_menu_prev, {menu: @active_menu} )
trigger("show_#{@active_menu}".to_sym)
end
event :move_menu_prev do |hash_args|
trigger(:_menu_prev_, hash_args[:menu])
end
event :menu_next_event do
trigger(:move_menu_next, {menu: @active_menu} )
trigger("show_#{@active_menu}".to_sym)
end
event :move_menu_next do |hash_args|
trigger(:_menu_next_, hash_args[:menu])
end
keys do
key('k') do
trigger(:menu_prev_event)
end
key('j') do
trigger(:menu_next_event)
end
key('h') do
trigger(:show_help_menu)
end
key('g') do
trigger(:show_game_menu)
end
end
...
end
Great project. I just started playing around with the Menu feature. I wanted to see how I could reuse the "next" & "prev" key commands to navigate different menus that appear in the same interface (like child menus that drill down as you make selections along the way). I quickly got the following code to work and wanted to see if there was a better approach that I'm missing. Is there a built-in way to get context for key triggers/events? Do you think that some kind of 'system of related menus' might be in vedeu's future?