From: Jeroen van der Zijp <jeroen@...>
To: foxgui-users@...; Feng Feng <askfoxtoolkit@...>
Sent: Wednesday, June 17, 2009 10:55:25 PM
Subject: Re: [Foxgui-users] How to embed a Checkbox into the FXTable?
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. |
+----------------------------------------------------------------------------+