On Tuesday 09 June 2009, Mad Max wrote:
>
> Hi all,
> I'm just starting studing FOX-1.6.36 and I have a question regarding
> FXTable.
> In particular, it's not really clear to me the "insert row"/"delete row"
> behaviour.
> Please consider this change in the example code table.c:
>
> // Deleted
> long TableWindow::onTableDeleted(FXObject*,FXSelector,void* ptr)
> {
> FXTableRange *tr=(FXTableRange*)ptr;
> FXTRACE((10,"SEL_DELETED fm.row=%d, fm.col=%d to.row=%d,
> to.col=%d\n",tr->fm.row,tr->fm.col,tr->to.row,tr->to.col));
>
> FXint r,c,nr,nc;
>
> nr=table->getNumRows();
> nc=table->getNumColumns();
>
> for(r=0; r<nr; r++)
> {
> for(c=0; c<nc; c++)
> {
> table->setItemText(r,c,"r_ridim:"+FXStringVal(r+1)+"
> c_ridim:"+FXStringVal(c+1));
> }
> }
>
> return 1;
> }
>
> what happens is that execution of the code above is done before row deletion
> while the same code in the insert row code is (correctly to me) done after
> row insertion.
>
> for example if I delete row 4 I got traces:
>
> [2176] SEL_DELETED fm.row=4, fm.col=0 to.row=4, to.col=6
> [2176] delete item r_ridim:5 c_ridim:1
> [2176] delete item r_ridim:5 c_ridim:2
> [2176] delete item r_ridim:5 c_ridim:3
> [2176] delete item r_ridim:5 c_ridim:4
> [2176] delete item r_ridim:5 c_ridim:5
> [2176] delete item r_ridim:5 c_ridim:6
> [2176] delete item r_ridim:5 c_ridim:7
>
> so I got a table switching from element r_ridim:4 c_ridim:1 to element
> r_ridim:6 c_ridim:1 that is not what I want.
>
> Where I'm wrong?
>
> Thanks and regards,
> Mad Max
>
OK,
Sorry I didn't reply sooner.
Basically, SEL_DELETED is issued PRIOR to the items being deleted. When you re-initialize
the contents of the table while inside the callback, the old cells are still there and are
being overwritten with the new contents. Thus, the cells being actually deleted are the
new values, not the old ones.
Note, it says so in the documentation ;-)
- Jeroen
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects_______________________________________________
Foxgui-users mailing list
Foxgui-users@...
https://lists.sourceforge.net/lists/listinfo/foxgui-users