Sponsored Content
Top Forums Shell Programming and Scripting Perl - start search by using search button or by pressing the enter key Post 302840723 by popeye on Tuesday 6th of August 2013 11:04:54 AM
Old 08-06-2013
Ok I got side tracked.

I am trying to solve two problems.

The first
When the program starts, I want to have the cursor already placed in the text entry box. Right now I have to click in that box, then enter data.

The second

The user should be able to enter data then hit the return key to execute the search
or
enter data and press the search key to execute the search.




Code:
#!C:\Perl64\bin\perl.exe
require Tk;
use Tk;
use strict;

my $text456;

my $main = MainWindow->new();
$main->configure(-title => 'Popeyes Cheap Windows Program',
                 -background => 'blue');


#build separator
my $lin=$main->Frame(-borderwidth=> 8)->pack(-side=>'top');
my $stat=$lin->Label (-width=>40, -height=>0)->pack();
$stat->configure(-text=>"Popeyes Cheap Window Program");


#Build label and text box
$main->Label(
       -text => "Enter sumtin below:"
    )->pack();
 $main->Entry(
        -textvariable => \$text456,-width=>7, -borderwidth=>6, -relief=>'sunken'
    )->pack();


#Setup Search button/execute input check and search. 
$main->Button(
        -text => "Search",
        -command =>
          sub {
           errchk ($text456);
           dosearch ($text456);
           }#end sub   
     )->pack();


Thanks in advance for the help !!
 

10 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Make the SEARCH button REALLY BIG

Neo, Maybe it would be best to make the search button/option more visible? I know when I came here the first time, I didn't really notice that option. Just an idea. It appears that some people either don't see it.. or the obvious, don't want to use it, but I'd suggest that it's more of the... (8 Replies)
Discussion started by: ober5861
8 Replies

2. UNIX for Dummies Questions & Answers

Pressing backspace key simulates enter key

Hi, Whenever i press the backspace key, a new line appears, i.e. it works like a enter key. :confused: Thanks (2 Replies)
Discussion started by: vibhor_agarwali
2 Replies

3. Shell Programming and Scripting

Perl: Search for string on line then search and replace text

Hi All, I have a file that I need to be able to find a pattern match on a line, search that line for a text pattern, and replace that text. An example of 4 lines in my file is: 1. MatchText_randomNumberOfText moreData ReplaceMe moreData 2. MatchText_randomNumberOfText moreData moreData... (4 Replies)
Discussion started by: Crypto
4 Replies

4. Shell Programming and Scripting

Pressing Enter (bash)

Hey, I'm writing this BASH script, I recently started learning BASH after I did Java and I'm pretty new to the syntax. Anways, what I want to do is simple, I coudn't find the right information though: Let's say I make a : read -p "Press ENTER to go back to menu" choice ..... What is... (34 Replies)
Discussion started by: Yakuzan
34 Replies

5. Shell Programming and Scripting

Pressing "Enter/Space bar" using Net::TELNET? in Perl

I'm trying to learn how to get my script to execute the enter button when it telnets into a router and the router displays output but you need to press the space bar or enter button to continue displaying my output of the router. How is this done? (0 Replies)
Discussion started by: xmaverick
0 Replies

6. Shell Programming and Scripting

enter key or carriage return as input in perl

hi experts Question in perl i'm creating a script to take from user a different inputs one of them is the carriage return .. so that i want to make an if condition if the user hit enter key the user will go to previous step it something like that chomp ($input = <STDIN>); if ($input =~... (3 Replies)
Discussion started by: doubando
3 Replies

7. Shell Programming and Scripting

Pressing enter and script still goes on

i have a bash shell script and i press enter and the script still continues on? how do i stop this (3 Replies)
Discussion started by: gangsta
3 Replies

8. Shell Programming and Scripting

Want to write a command that keeps pressing enter key in regular interval

Hi, I m new to linux, can you pls help me to write a command/ script that keeps pressing the enter key in regular interval. Thx, Linux1 (2 Replies)
Discussion started by: mylinux1
2 Replies

9. Shell Programming and Scripting

Perl - use search keywords from array and search a file and print 3rd field when matched

Hi , I have been trying to write a perl script to do this job. But i am not able to achieve the desired result. Below is my code. my $current_value=12345; my @users=("bob","ben","tom","harry"); open DBLIST,"<","/var/tmp/DBinfo"; my @input = <DBLIST>; foreach (@users) { my... (11 Replies)
Discussion started by: chidori
11 Replies

10. Shell Programming and Scripting

Script termination without pressing Enter key[nohup]

I have a script in which we have used nohup. Once script is executed it will be terminated only when enter key is pressed. I want the script to be terminated without pressing enter key nohup imqbrokerd -name user_id port 2>1 1>$home_`date` & I am a newbie to shell, Kindly please help (3 Replies)
Discussion started by: Suganbabu
3 Replies
label(n)						       Tk Built-In Commands							  label(n)

__________________________________________________________________________________________________________________________________________________

NAME
label - Create and manipulate label widgets SYNOPSIS
label pathName ?options? STANDARD OPTIONS
-activebackground -disabledforeground -padx -activeforeground -font -pady -anchor -foreground -relief -background -highlightbackground -takefocus -bitmap -highlightcolor -text -borderwidth -highlightthickness -textvariable -compound -image -underline -cursor -justify -wraplength See the options manual entry for details on the standard options. WIDGET-SPECIFIC OPTIONS [-height height] Specifies a desired height for the label. If an image or bitmap is being displayed in the label then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in lines of text. If this option is not specified, the label's desired height is computed from the size of the image or bitmap or text being displayed in it. [-state state] Specifies one of three states for the label: normal, active, or disabled. In normal state the button is displayed using the foreground and background options. In active state the label is displayed using the activeForeground and activeBackground options. In the disabled state the dis- abledForeground and background options determine how the button is displayed. [-width width] Specifies a desired width for the label. If an image or bitmap is being displayed in the label then the value is in screen units (i.e. any of the forms acceptable to Tk_GetPixels); for text it is in characters. If this option is not specified, the label's desired width is computed from the size of the image or bitmap or text being displayed in it. _________________________________________________________________ DESCRIPTION
The label command creates a new window (given by the pathName argument) and makes it into a label widget. Additional options, described above, may be specified on the command line or in the option database to configure aspects of the label such as its colors, font, text, and initial relief. The label command returns its pathName argument. At the time this command is invoked, there must not exist a window named pathName, but pathName's parent must exist. A label is a widget that displays a textual string, bitmap or image. If text is displayed, it must all be in a single font, but it can occupy multiple lines on the screen (if it contains newlines or if wrapping occurs because of the wrapLength option) and one of the charac- ters may optionally be underlined using the underline option. The label can be manipulated in a few simple ways, such as changing its relief or text, using the commands described below. WIDGET COMMAND
The label command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget. It has the following general form: pathName option ?arg arg ...? Option and the args determine the exact behavior of the command. The following commands are possible for label widgets: pathName cget option Returns the current value of the configuration option given by option. Option may have any of the values accepted by the label com- mand. pathName configure ?option? ?value option value ...? Query or modify the configuration options of the widget. If no option is specified, returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for information on the format of this list). If option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). If one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. Option may have any of the values accepted by the label command. BINDINGS
When a new label is created, it has no default event bindings: labels are not intended to be interactive. EXAMPLE
# Make the widgets label .t -text "This widget is at the top" -bg red label .b -text "This widget is at the bottom" -bg green label .l -text "Left Hand Side" label .r -text "Right Hand Side" text .mid # Lay them out pack .t -side top -fill x pack .b -side bottom -fill x pack .l -side left -fill y pack .r -side right -fill y pack .mid -expand 1 -fill both SEE ALSO
labelframe(n), button(n), ttk::label(n) KEYWORDS
label, widget Tk 4.0 label(n)
All times are GMT -4. The time now is 08:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy