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
I'm trying to create an application that has a tab item for each opened file, for example. Currently, the only way I can see to declare tabs is during the initial declaration of the app, but I do not see any way to add new items or edit the tabs after the app is initialized.
Here's a skeleton of the code I'm working on:
require'glimmer-dsl-libui'includeGlimmeropen_files=[]menu('File'){menu_item('Open work file...'){on_clickeddofile=open_fileunlessfile.nil?open_files.pushfile# somehow convince main to re-initialize the tabs?endend}}main=window('File Tabs'){tab{open_files.eachdo |filename|
tab_itemfilenameend}}main.show
Any help would be appreciated.
The text was updated successfully, but these errors were encountered:
You must use the .content {} method to re-open the tab content and add new tab items in. The .content {} method works on all GUI controls.
Here is the code updated to add tab items properly and also open the file content inside the tab item:
require'glimmer-dsl-libui'includeGlimmeropen_files=[]menu('File'){menu_item('Open work file...'){on_clickeddofile=open_fileputsfileunlessfile.nil?open_files.pushfile@tab.content{# re-open tab content and add a new tab itemfilename=File.basename(file)tab_item(filename){non_wrapping_multiline_entry{textFile.read(file)}}}endend}quit_menu_item}main=window('File Tabs',900,600){@tab=tab{open_files.eachdo |filename|
tab_item(filename)end}}main.show
Hey there,
I'm trying to create an application that has a tab item for each opened file, for example. Currently, the only way I can see to declare tabs is during the initial declaration of the app, but I do not see any way to add new items or edit the tabs after the app is initialized.
Here's a skeleton of the code I'm working on:
Any help would be appreciated.
The text was updated successfully, but these errors were encountered: