#!/usr/bin/perl # This program will select items via checkbox # This program will then save these selections to a log file it creates # This is figuring out how frames work, checkbox, radiobutton, file browser. # Validates input -> later # March 20 2022 use strict; use warnings; use Tk; use Tk::Checkbutton; use Tk::Radiobutton; use Tk::Pane; use Tk::BrowseEntry; #my $file = "expenses"; #add validation if file exists. #-----------------FH open/close------------------# #open Log file here ....I think it is here to get tail -f of final output #---------------Declare vars---------------------# my ($var1,$var2,$var3,$var4); my $current_file=(); #--------------------Frames geometries-----------# my $mw = MainWindow->new(); $mw->geometry("1000x500"); $mw->title("Check using GUI"); #-----------------Frames-----------------------# my $main_frame = $mw->Frame()->pack( -side => 'top', - fill => 'x' ); my $top_frame = $mw->Frame( -background => 'light green' )->pack( -side => 'top', -fill => 'x' ); my $left_frame = $mw->Frame( -background => 'gray' , -width => 45)->pack( -side => 'left', -fill => 'y' ); my $right_frame = $mw->Frame( -background => 'white', -foreground => 'white' )->pack( -side => 'right', -fill => 'y' ); # This is the Special Notes area for user to add text my $frm_frame = $mw->Frame( -background => 'light blue' )->pack( -side => 'right' , -fill => 'x'); #---------------TOP Widget-------------------------# $top_frame->Label( -text => "Bank statement Checks", -background => 'light green' ) ->pack( -side => 'top' ); #------------LEFT wedget-------------------------# $left_frame->Label( -text => 'Checks Selection', -background => 'white', -width => 45 )->pack( -side => 'top', -fill => 'both' ); #-----------adding file browser to chose the Checks.txt file-------------# our $mw = MainWindow->new; $mw->configure(-title=> "File Browser"); my $menu_f = $mw->Frame()->pack(-side=>'top',-fill=>'x'); my $menu_file = $menu_f->Menubutton (-text=>'Select File Browser',-tearoff=>'false') ->pack(-side=>'left'); $menu_file->command(-label=>'...', -command=> \&open_txt); # This opens txt files where checks written with amounts # GRRR! -command isn't working for me here, where did I go wrong??!!! #------------Right checkButtons------------------------# my $right_text; my ($check1, $check2, $check3, $check4); $check1= $right_frame->Checkbutton( -text => "Confirm check was used for home to school travel, books, meals", -onvalue => 1, -background => 'white', -variable => \$var1, )->pack(); $check2= $right_frame->Checkbutton( -text => "Discuss check usage are only for school expenditures", -onvalue => 1, -background => 'white', -variable => \$var2, )->pack(); $check3= $right_frame->Checkbutton( -text => "Archive the checks that are to come visit home segregated from other travel from home to school", -onvalue => 1, -background => 'white', -variable => \$var3, )->pack(); #### HOW to add another popup Checkbox when $check3 is selected; is it Parents HOME or Grand Parent's home if ($var3 == 1 ){ ## how to get logic to recognized $check3 is selected?? then opo up with new additional checkbox selection is it == 1 or eq true??? my $check20= my $frm_frame= $mw ->Frame(); my $check_travel = my $frm_name ->Label ( -text => "Check from school to home travel"); my $ent = $frm_name -> Entry(); # This is not right either!! I've tried many things unsuccessful ...Need to ask for help! } $check4= $right_frame->Checkbutton( -text => "Confirm there were no Check errors/corrupted files during audit", -onvalue => 1, -background => 'white', -variable => \$var4, )->pack(); #---------- Exit Button -----------------------# my $left_text; my $exitButton= $left_frame->Button( -text => "Done" , -command => sub { exit } )->pack( -side => 'bottom' , -fill =>'both', -expand =>1); #------------Enter button && save to Log file-------------------# my $executeButton = $left_frame->Button( -text => "Enter" , -command => sub { Echo_to_Log($left_text);} )->pack( -side => 'bottom', -fill => 'both' , -expand =>1); # Caputure ALL of checkboxes and Path to files, # shoudl it be "left_text" && $right_text(create if so)?How to do this?jj #------------format Enter and Done buttons ----# $left_text = $left_frame->Text( -height => 30, -width => 30 , )->pack( -side => 'left' , -fill => 'both', -expand =>1 ); #--------------Format right buttons -----# $right_text= $right_frame->Text( -height => 30, -width => 70, )->pack( -side => 'right' , -fill => 'both', -expand =>1 ); MainLoop; sub open_txt { my @types = (["txt files", [qw/.txt /]], ["All files", '*'], ); $current_file= $mw->getOpenFile(-filetypes => \@types); print "$current_file\n"; } sub Echo_to_log { # let's put all the selections into a Logfile. I am not sure if a -tail -f will work here because I want only selected windows }