@@ -19049,30 +19049,37 @@ onDisplayGene <- function() {
19049
19049
geneEntry <- tkentry(geneDialog, width = 30)
19050
19050
tkgrid(geneEntry, padx = 10, pady = 5)
19051
19051
19052
- # Listbox to display the available gene names from species$genes$name
19052
+ # Dropdown (combobox) populated with available gene names from species$genes$name
19053
19053
geneNamesList <- species$genes$name # Assuming this is a list of available gene names
19054
- geneListVar <- tclVar() # Variable to store the listbox data
19055
- tclObj(geneListVar) <- geneNamesList
19054
+ geneDropdown <- ttkcombobox(geneDialog, values = geneNamesList, width = 27)
19055
+ tkgrid(geneDropdown, padx = 10, pady = 5)
19056
+
19057
+ ### Add a Listbox to Display Gene Names ###
19058
+ geneListVar <- tclVar()
19059
+ tclObj(geneListVar) <- geneNamesList # Populate the listbox with gene names
19056
19060
19057
- # Create listbox for gene names
19058
19061
geneListbox <- tklistbox(geneDialog, listvariable = geneListVar, selectmode = "single", width = 30, height = 10)
19059
19062
tkgrid(geneListbox, padx = 10, pady = 5)
19060
19063
19061
19064
# Scrollbar for the listbox
19062
19065
listScrollbar <- ttkscrollbar(geneDialog, orient = "vertical", command = function(...) tkyview(geneListbox, ...))
19063
19066
tkconfigure(geneListbox, yscrollcommand = function(...) tkset(listScrollbar, ...))
19064
- tkgrid(listScrollbar, column = 2, row = 3 , sticky = "ns")
19065
-
19067
+ tkgrid(listScrollbar, column = 2, row = 4 , sticky = "ns")
19068
+
19066
19069
# Function to handle the 'OK' button click
19067
19070
onOK <- function() {
19068
- # Get the gene name from the entry box if available
19071
+ # Get the gene name from either the entry box, dropdown, or listbox
19069
19072
geneName <- tclvalue(geneEntry)
19070
19073
19071
- # If no entry, check the listbox selection
19074
+ if (nchar(geneName) == 0) {
19075
+ geneName <- tclvalue(geneDropdown) # Fall back to dropdown selection
19076
+ }
19077
+
19078
+ # Get the selected item from the listbox if nothing else is selected
19072
19079
if (nchar(geneName) == 0) {
19073
19080
selectedIdx <- as.integer(tkcurselection(geneListbox))
19074
19081
if (length(selectedIdx) > 0) {
19075
- geneName <- geneNamesList[selectedIdx + 1] # Listbox is 0-indexed, hence the +1
19082
+ geneName <- geneNamesList[selectedIdx + 1] # Listbox is 0-indexed
19076
19083
}
19077
19084
}
19078
19085
@@ -19106,8 +19113,7 @@ onDisplayGene <- function() {
19106
19113
tkfocus(geneDialog)
19107
19114
}
19108
19115
19109
- # Create a button to display the dialog
19110
- displayGeneButton <- ttkbutton(genePlotTypeFrame, text = 'Display Single Gene', width = 21, command = onDisplayGene)
19116
+ displayGeneButton <- ttkbutton(genePlotTypeFrame, text='Display Single Gene', width=21, command=onDisplayGene)
19111
19117
19112
19118
onDisplayProteome <- function()
19113
19119
{
0 commit comments