« Return to Thread: Why my onTableReplaced is not called?

Re: Why my onTableReplaced is not called?

by Jeroen van der Zijp :: Rate this Message:

Reply to Author | View in Thread

On Thursday 25 June 2009, Feng Feng wrote:

> Hello all,
>
> I have designed a subclass of FXTable as follows,
>
> The problem is that the function onTableReplaced is never triggered after I enter some text in the table and then press enter.
>
> Do you know why?
>
> Thank you
>
>
> class PointTable : public FXTable
> {
>     FXDECLARE(PointTable )
>     ...
>     long onKeyPress(FXObject*,FXSelector,void*);
>     long onTableReplaced(FXObject*,FXSelector,void*);
>     ....
> }
>
>
> // Map
> FXDEFMAP(PointTable ) PointTableMap[]={
>     FXMAPFUNC(SEL_KEYPRESS,      0, PlanPointTable::onKeyPress),
>     FXMAPFUNC(SEL_REPLACED,      0,PlanPointTable::onTableReplaced),
>
> };
>
> // Object implementation
> FXIMPLEMENT(PointTable ,FXTable,PointTable Map,ARRAYNUMBER(PointTableMap))
>
> // onKeyPress is triggered correctly.
> long PlanPointTable::onKeyPress(FXObject *obj, FXSelector sel, void* ptr)
> {
>      if ( !isEditable() || current.col<0 || current.col >= ncols
>          || current.row<0 || current.row >= nrows)
>      {
>          return 1;
>      }
>  
>      if (current.col == 0 || current.col == 2)
>      {
>          return 1;
>      }
>
>     return FXTable::onKeyPress(obj, sel, ptr);
> }
>
> // Replaced
> long PlanPointTable::onTableReplaced(FXObject*,FXSelector,void* ptr){
>  
>    //... NEVER get called after I enter some text and press ENTER
>    
>    
>     return 1;      
>   }

When acceptInput(true) is invoked via FXTable receiving ID_ACCEPT_INPUT from
the edit-control, it sends a SEL_REPLACED to its target.

It does NOT send a SEL_REPLACED to itself....


                - Jeroen

------------------------------------------------------------------------------
_______________________________________________
Foxgui-users mailing list
Foxgui-users@...
https://lists.sourceforge.net/lists/listinfo/foxgui-users

 « Return to Thread: Why my onTableReplaced is not called?