Grid & password cell

Hi,

I use a grid as a display as well as data structure: there is information in
that grid that I wish to hide from the user ... one of them is a password
column.

I tried to change the column size to 0 without success ... is there a way to
hide that infomation (ex: even seeing stars on the grid cells would be fine).

Thanks,

Philippe

···

--
_________________________
Philippe C. Martin
www.snakecard.com
_________________________

Store the information however you want, set up the grid to be virtual,
and override the GetValue() method to return something like '********'
on the password column.

- Josiah

···

"Philippe C. Martin" <pmartin@snakecard.com> wrote:

I use a grid as a display as well as data structure: there is information in
that grid that I wish to hide from the user ... one of them is a password
column.

I tried to change the column size to 0 without success ... is there a way to
hide that infomation (ex: even seeing stars on the grid cells would be fine).

So I should derive from the grid ? right now it is just another widget in a
panel.

Philippe

···

On Tuesday 02 May 2006 12:56 pm, Josiah Carlson wrote:

"Philippe C. Martin" <pmartin@snakecard.com> wrote:
> I use a grid as a display as well as data structure: there is information
> in that grid that I wish to hide from the user ... one of them is a
> password column.
>
> I tried to change the column size to 0 without success ... is there a way
> to hide that infomation (ex: even seeing stars on the grid cells would be
> fine).

Store the information however you want, set up the grid to be virtual,
and override the GetValue() method to return something like '********'
on the password column.

- Josiah

--
_________________________
Philippe C. Martin
www.snakecard.com
_________________________

Philippe C. Martin wrote:

Hi,

I use a grid as a display as well as data structure: there is information in that grid that I wish to hide from the user ... one of them is a password column.

I tried to change the column size to 0 without success ...

The grid protects cols and rows from being resized to zero by the user in order to protect against their losing the ability to size it larger again. If you want to programatically set the size to zero you can do so, but first you need to call SetColMinimalWidth and set the min width to zero.

is there a way to hide that infomation (ex: even seeing stars on the grid cells would be fine).

You can use a custom renderer for that col that just draw stars, but if you want it to not be shown at all then the best thing is to separate your model (the data) from the view (the grid window). Put your data in some other structure and then use a class derived from wx.grid.PyGridTableBase that provides the data elements to the grid on demand. Then you can either just not provide that column at all, or provide "*****" or whatever. See the samples in the demo that use a grid table for an example.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Got it ! thanks.

Philippe

···

On Tuesday 02 May 2006 01:34 pm, Robin Dunn wrote:

Philippe C. Martin wrote:
> Hi,
>
> I use a grid as a display as well as data structure: there is information
> in that grid that I wish to hide from the user ... one of them is a
> password column.
>
> I tried to change the column size to 0 without success ...

The grid protects cols and rows from being resized to zero by the user
in order to protect against their losing the ability to size it larger
again. If you want to programatically set the size to zero you can do
so, but first you need to call SetColMinimalWidth and set the min width
to zero.

> is there a way to
> hide that infomation (ex: even seeing stars on the grid cells would be
> fine).

You can use a custom renderer for that col that just draw stars, but if
you want it to not be shown at all then the best thing is to separate
your model (the data) from the view (the grid window). Put your data in
some other structure and then use a class derived from
wx.grid.PyGridTableBase that provides the data elements to the grid on
demand. Then you can either just not provide that column at all, or
provide "*****" or whatever. See the samples in the demo that use a
grid table for an example.

--
_________________________
Philippe C. Martin
www.snakecard.com
_________________________

Why would you include a column that is essentially hidden? What
information are you giving the user? My advice is to not display the
password at all in the grid.

···

On 5/2/06, Philippe C. Martin <pmartin@snakecard.com> wrote:

Hi,

I use a grid as a display as well as data structure: there is information in
that grid that I wish to hide from the user ... one of them is a password
column.

I tried to change the column size to 0 without success ... is there a way to
hide that infomation (ex: even seeing stars on the grid cells would be fine).

--

# p.d.