Re: Can't find duplicates after only Backspace in entry field.



I've just had a quick look at your program, but I think the regular
expression you are using to find the duplicate is not correct in this
case.

Try
    if ( $model->get($iter, $column) =~ /^$search_string$/ )

instead of 

    if ( $model->get($iter, $column) =~ /$search_string/ )

See http://perldoc.perl.org/perlre.html#Regular-Expressions for more
info.

Regards
Mario

Am Donnerstag, den 14.01.2010, 03:38 -0800 schrieb Zettai Muri:
Hi All,

I have used: 
http://forgeftp.novell.com//gtk2-perl-study/documentation/html/sample_programs/gtk2_treeview_simple.pl as 
the basis for the attached program.  Many thanks to Dirk van der Walt for such an awesome guide.

When a row in the tree view is selected it populates the entry box below it.

What I'm trying to do is make sure duplicates aren't added to the list. However I am getting strange 
results depending on what I type into the entry field:
1. After launching the program, when I select row 2, "Row 2" appears in the entry box.
2. I place the cursor in the entry field at the end and press <Backspace>
3. I then click the 'Add' button.

Duplicate dialog appears with message:
"Row " has already been added. (But it doesn't appear in the list)


If I do the following:
1. After launching the program, when I select row 2, "Row 2" appears in the entry box.
2. I place the cursor in the entry field at the end and press <Backspace>
3. I type any letter/number for example "Row Z"
4. I then click the 'Add' button.

The output is "Adding Row Z to list"

How do I get the program to recognise that after <Backspace> the entry in the field is not actually in the 
list?

Could someone please take a look at my code and explain what I'm doing wrong?

Many thanks for your help.

ZM.


      __________________________________________________________________________________
See what's on at the movies in your area. Find out now: http://au.movies.yahoo.com/session-times/
_______________________________________________ gtk-perl-list mailing list gtk-perl-list gnome org 
http://mail.gnome.org/mailman/listinfo/gtk-perl-list





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]