Dear Dushan,

you can make a model's item editable by setting the ItemIsEditable flag:

model->item(row, col)->setFlags(ItemIsEditable);

You can find an example for this in
wt/examples/charts/ChartsExample.C::readCsvFile

If you want to create an editor which only allows numeric input,
you will have to make a custom implementation of WItemDelegate.
The documentation of WItemDelegate explains how this can be done.

You can assign your WItemDelegate to a certain column using:

tableview->setItemDelegateForColumn(2, new NumericItemDelegate(this));


Kind regards,

Pieter


On 12 June 2010 12:15, Dushan Savich <[email protected]> wrote:

> Hi all,
>
> I've used Ext::TableView  , and I've decided to try this WTableView ,
> to see how it works.
>
> To make column Ext::TableView's column editable you only needed to do this:
>
> cellEditor_ = new NumberField ( this ) ;
> tableView_->setEditor ( 2 , cellEditor_ );
>
>
> But for this WTableView , you obviously need to mess around
> WItemModel, WItemDelegate , and 5 other things, and there is no simple
> example which clearly shows how to glue that all together :-)
>
> I aint't dumb, but I don't get it.  Could someone please post an
> example here?  :-)
>
>
> --
> Kind Regards,
> Dushan Savich
> [email protected]
> http://stosha.com/
> +381 64 329 33 55
> Nehruova 95/51
> 11070 New Belgrade
> Belgrade
> Serbia
>
>
> ------------------------------------------------------------------------------
> ThinkGeek and WIRED's GeekDad team up for the Ultimate
> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
> lucky parental unit.  See the prize list and enter to win:
> http://p.sf.net/sfu/thinkgeek-promo
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to