comparison src/luan_editor/window.luan @ 43:48c35fdccb31

list window work
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 18 May 2025 18:47:32 -0600
parents b76918e3e77c
children 779ea6d9d8fb
comparison
equal deleted inserted replaced
42:b76918e3e77c 43:48c35fdccb31
70 view = list_view 70 view = list_view
71 } 71 }
72 local list_window = new_dialog{ 72 local list_window = new_dialog{
73 preferred_size = { width=200, height=400 } 73 preferred_size = { width=200, height=400 }
74 content_pane = list_scroll_pane 74 content_pane = list_scroll_pane
75 focusable_window_state = false
75 } 76 }
76 local list_group = new_button_group() 77 local list_group = new_button_group()
77 78
78 local function new_list_window_item(text) 79 local function new_list_window_item(text)
79 local rb = new_radio_button{ 80 local rb = new_radio_button{
166 if n_windows == 0 then 167 if n_windows == 0 then
167 Luan.exit() 168 Luan.exit()
168 end 169 end
169 remove_list_window_item(window.list_window_item) 170 remove_list_window_item(window.list_window_item)
170 end) 171 end)
172 frame.add_window_focus_listener(function()
173 window.list_window_item.is_selected = true
174 end)
171 frame.add_resize_stopped_listener( 200, function() 175 frame.add_resize_stopped_listener( 200, function()
172 --logger.info(stringify(frame.size)) 176 --logger.info(stringify(frame.size))
173 config.size = frame.size 177 config.size = frame.size
174 save_config() 178 save_config()
175 end) 179 end)
184 s = s.." *" 188 s = s.." *"
185 end 189 end
186 frame.title = s 190 frame.title = s
187 end 191 end
188 set_title() 192 set_title()
189 window.list_window_item = new_list_window_item(title) 193 local list_window_item = new_list_window_item(title)
194 list_window_item.add_action_listener(function(_)
195 text_area.request_focus()
196 end)
197 window.list_window_item = list_window_item
190 window.set_title = set_title -- dont gc 198 window.set_title = set_title -- dont gc
191 text_area.document.add_undo_listener(set_title) 199 text_area.document.add_undo_listener(set_title)
192 window.new = new_window 200 window.new = new_window
193 function window.open() 201 function window.open()
194 local new_file = choose_file{ 202 local new_file = choose_file{