am developing a graphical user interface (GUI) that allows users to select one or more options via checkboxes. For each selected option, the GUI should perform the following actions sequentially:
- Pick File: Open a file picker dialog to allow the user to select a specific file related to the chosen option.
- Format and Save: Process the selected file using a predefined function that formats the data and saves the changes.
Nedd help:
I need help handling scenarios where multiple checkboxes are selected simultaneously, ensuring that each selected option independently triggers its associated functions without conflicts.
I'm unsure how to set up event listeners for each checkbox to trigger the corresponding functions when selected.
Outcome
- Users can select one or more options via checkboxes.
- Upon selection, for each checked box:
- A file picker dialog appears for the user to select the relevant file.
- The selected file is processed by the formatting function.
- The formatted data is saved appropriately.
- The GUI remains responsive and provides feedback during and after the operations.
I have attached the code so far with comments where i need help.. also if there is a more elegant solution for gui please share
Thank you
Names Default To Here( 1 );
directory_to_collect_data_table = "/C:/Users/";
data_list = {"datatable_1 ", "datatable_2", "datatable_3"};
userInput_dt = Function( {},
dt = Pick File(
"3. Pick Up Data Table_Total#1",
directory_to_collect_data_table,
{"JMP Files|jmp;jsl;jrn", "All Files|*"},
1,
0,
"",
"multiple"
);
Return( dt );
);
datatable_1func = Function( {dt},
dt << New Column( "label",
Character, // The new column will store character values
Formula(
"D" || Substitute( :Extracted_Data, "A", "" ) // Prepend "D" and remove "A"
)
);
dt << Column( "Extracted_Data" ) << Hide( 1 );
dt:ROW1 << Data Type( Character );
final_data1 = Data Table( "final_data" );
);
// GUI for selecting and merging files
Userinput_1 = New Window(
Panel Box( "Select the datatable",
Check Box( data_list ),
Button Box( "Select Files", Userinput_1//add functionality
//add functionality if datatable_1 is selected then call function datatable_1func ( datatable_1 );
//whichever check box is selected accordingly a function is called
)
)
)
);