« Return to Thread: How to embed a Checkbox into the FXTable?

Re: How to embed a Checkbox into the FXTable?

by Jeroen van der Zijp :: Rate this Message:

Reply to Author | View in Thread

On Wednesday 17 June 2009, Feng Feng wrote:
> Hello all,
>
> I need to create a table with the column filled with Checkbox.
>
> How do I implement this customized table? Any example?

What you want is a custom cell type.  One standard provided custom cell
type is FXComboTableItem, derived from FXTableItem.

Custom items may overload some of the functionality in FXTableItem; for
example, drawContent().  The basic FXTableItem draw() function is split
into drawBackground(), drawPattern(), drawContent() and then drawBorders().

Each of these are overloadable, but my suggestion is to only overload
drawContent().

Next, when the user clicks on the item to edit it, the FXTableItem's
getControlFor() API is called, its purpose is to create a widget to
edit the cell contents.  The standard FXTableItem's implementation
makes a FXTextField, sets the appropriate text justification options,
and fills the contents of the FXTextField with the value of the cell.

The control is placed over the cell by the FXTable.  After the user is
done with editing, the items setFromControl() is called.  The default
implementation grabs the text from the FXTextField and sticks it into
the cell.

The code in FXTable.{h,cpp} for implementing the FXComboTableItem may
be worth looking at to see how to implement a custom item.


        - Jeroen




--
+----------------------------------------------------------------------------+
| Copyright (C) 22:40 06/17/2009 Jeroen van der Zijp.   All Rights Reserved. |
+----------------------------------------------------------------------------+

------------------------------------------------------------------------------
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

 « Return to Thread: How to embed a Checkbox into the FXTable?