[Glade-users] ComboBoxEntry validation

Arthur Shats ashats at hotmail.com
Tue Nov 9 12:03:14 EST 2010


Thanks,
I think the simplest solution to validate the input against dropdown list is to store that list in an array/list and then 
call array.index(input) .  If it finds the index for the 'input' in the array, then there is a match; if it doesn't, then the 'input' is invalid. However, if it doesn't find the index, it throws an exception. So I am catching the exception and display an error msg. It's working for me so far.
If somebody thinks this is the wrong way to go, let me know please.
Thanks,
Arthur.
 
> Date: Tue, 9 Nov 2010 12:45:05 +0900
> Subject: Re: [Glade-users] ComboBoxEntry validation
> From: tristan.van.berkom at gmail.com
> To: ashats at hotmail.com
> CC: glade-users at lists.ximian.com
> 
> On Tue, Nov 9, 2010 at 3:01 AM, Arthur Shats <ashats at hotmail.com> wrote:
> > But my drop down list is built with gtk.ListStore and I
> > use .set_model. Doesn't ListStore have any methods that would help in
> > validation? I found this on the web:
> > "The tree models derived from gtk.GenericTreeModel are protected from
> > problems with out of date gtk.TreeIter objects because gtk.TreeIter objects
> > are automatically checked for validity with the tree model."
> > But I don't know how to make use of it. Whould this help in validation
> > comboBoxEntry entries agains the drop down list?
> 
> The validity of a GtkTreeIter in a GtkTreeModel just means that the iter
> has not gone out of date... iters are created by the model and they are
> temporal... when the model changes... any iters that you've stored
> become invalid.
> 
> Cheers,
> -Tristan
> 
> >
> > Thanks,
> > Arthur.
> >
> >
> >> Date: Sat, 6 Nov 2010 11:57:17 +0900
> >> Subject: Re: [Glade-users] ComboBoxEntry validation
> >> From: tristan.van.berkom at gmail.com
> >> To: ashats at hotmail.com
> >> CC: glade-users at lists.ximian.com
> >>
> >> You need to catch the signal fired when the user types the ENTER key
> >> ("activate" I believe) and do the check yourself.
> >>
> >> Cheers,
> >> -Tristan
> >>
> >> On Sat, Nov 6, 2010 at 1:58 AM, Arthur Shats <ashats at hotmail.com> wrote:
> >> > For comboBoxEntry fields that have a drop down list, is there a built-in
> >> > functionality to validate the input against the drop down list (so only
> >> > items from the list could be typed in) or I have to write my own
> >> > validation
> >> > check. I don't want to use comboBox instead of comboBoxEntry because I
> >> > want
> >> > the user to be able to start typing and then use EntryCompletion.
> >> >
> >> > Thanks much,
> >> > Arthur.
> >> >
> >> > _______________________________________________
> >> > Glade-users maillist  -  Glade-users at lists.ximian.com
> >> > http://lists.ximian.com/mailman/listinfo/glade-users
> >> >
> >> >
> >
> > _______________________________________________
> > Glade-users maillist  -  Glade-users at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/glade-users
> >
> >
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20101109/83eaf48f/attachment.html 


More information about the Glade-users mailing list