Re: [gtkmm] Customized CellRenderers
- From: Roger Leigh <roger whinlatter uklinux net>
- To: Murray Cumming <murrayc murrayc com>
- Cc: Leandro Fanzone <leandro hasar com>, gtkmm-list <gtkmm-list gnome org>
- Subject: Re: [gtkmm] Customized CellRenderers
- Date: Thu, 22 Apr 2004 00:55:08 +0100
Murray Cumming <murrayc murrayc com> writes:
> On Tue, 2004-04-20 at 14:36, Leandro Fanzone wrote:
>
>> > I'm working on writing an editable ListView, much like a database
>> > table editing tool. I would like to implement a new CellRenderer that
>> > prevents users from entering letters on an integer field on the fly
>> > (instead of checking this after the editing was done),
>
> I suggest that you ask on gtk-list. You probably need to derive a new
> CellRenderer, though I think a numeric_only property would be useful on
> the regular CellRendererText.
Even better would be a regular expression used to validate/restrict
input. For numeric types, this could be as simple as '[0-9]*', but
would give significantly more flexibility:
'[0-9][0-9]-[0-9][0-9]-[0-9][0-9]' (a simple date) and
'[0-9][0-9]:[0-9][0-9]' (time).
This need not be a large overhead: use regcomp on construction, and
regexec to validate and regfree on destruction.
You could allow different modes:
- restrict to valid input
- allow invalid input, but flag error (e.g. red background)
- validate on focus out or activation
- validate manually
This shouldn't be too difficult--I plan to derive a custom Entry and
CellRenderer when I find time.
--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]