]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/gupdlock.tex
added wxGridUpdateLocker helper class wrapping Begin/EndBatch() calls in a more conve...
[wxWidgets.git] / docs / latex / wx / gupdlock.tex
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %% Name: gupdlock.tex
3 %% Purpose: wxGridUpdateLocker documentation
4 %% Author: Evgeniy Tarassov
5 %% Created: 2007-03-15
6 %% RCS-ID: $Id$
7 %% Copyright: (c) 2007 TT-Solutions SARL
8 %% License: wxWindows license
9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10
11 \section{\class{wxGridUpdateLocker}}\label{wxgridupdatelocker}
12
13 This small class can be used to prevent \helpref{wxGrid}{wxgrid} from redrawing
14 during its lifetime by calling \helpref{wxGrid::BeginBatch}{wxgridbeginbatch}
15 in its constructor and \helpref{wxGrid::EndBatch}{wxgridendbatch} in its
16 destructor. It is typically used in a function performing several operations
17 with a grid which would otherwise result in flicker. For example:
18
19 {\small
20 \begin{verbatim}
21 void MyFrame::Foo()
22 {
23 m_grid = new wxGrid(this, ...);
24
25 wxGridUpdateLocker noUpdates(m_grid);
26 m_grid->AppendColumn();
27 ... many other operations with m_grid...
28 m_grid->AppendRow();
29
30 // destructor called, grid refreshed
31 }
32 \end{verbatim}
33 }
34
35 Using this class is easier and safer than calling
36 \helpref{BeginBatch}{wxgridbeginbatch} and \helpref{EndBatch}{wxgridendbatch}
37 because you don't risk not to call the latter (due to an exception for example).
38
39 \wxheading{Derived from}
40
41 None.
42
43 \wxheading{Include files}
44
45 <wx/grid.h>
46
47
48 \latexignore{\rtfignore{\wxheading{Members}}}
49
50
51 \membersection{wxGridUpdateLocker::wxGridUpdateLocker}\label{wxgridupdatelockerctor}
52
53 \func{}{wxGridUpdateLocker}{\param{wxGrid *}{grid = \NULL}}
54
55 Creates an object preventing the updates of the specified \arg{grid}. The
56 parameter could be \NULL in which case nothing is done. If \arg{grid} is
57 non-\NULL then the grid must exist for longer than wxGridUpdateLocker object
58 itself.
59
60 The default constructor could be followed by a call to
61 \helpref{wxGridUpdateLocker::Create}{wxgridupdatelockercreate} to set the
62 grid object later.
63
64
65
66 \membersection{wxGridUpdateLocker::\destruct{wxGridUpdateLocker}}\label{wxgridupdatelockerdtor}
67
68 \func{}{\destruct{wxGridUpdateLocker}}{\void}
69
70 Destructor reenables updates for the grid this object is associated with.
71
72
73
74 \membersection{wxGridUpdateLocker::Create}\label{wxgridupdatelockercreate}
75
76 \func{void}{Create}{\param{wxGrid* }{grid}}
77
78 This method can be called if the object had been constructed using the default
79 constructor. It must not be called more than once.
80
81