(clicking an item toggles the item on or off independently of other
selections).
-List box elements are numbered from zero.
+List box elements are numbered from zero. Their number is limited in
+some platforms (e.g. ca. 2000 on GTK).
A listbox callback gets an event wxEVT\_COMMAND\_LISTBOX\_SELECT for single clicks, and
wxEVT\_COMMAND\_LISTBOX\_DOUBLE\_CLICKED for double clicks.
within OnDraw, to set the device origin for the device context according to the current
scroll position.
+Note that the underlying system knows nothing about scrolling coordinates, so that all system
+functions (mouse events, expose events, refresh calls etc) as well as the position of subwindows
+are relative to the "physical" origin of the scrolled window. If the user insert a child window at
+position (10,10) and scrolls the window down 100 pixels (moving the child window out of the visible
+area), the child window will report a position of (10,-90).
+
\wxheading{Derived from}
\helpref{wxPanel}{wxpanel}\\
scrolling is the physical transfer of bits up or down the
screen when a scroll event occurs. If the application scrolls by a
variable amount (e.g. if there are different font sizes) then physical
-scrolling will not work, and you should switch it off.
+scrolling will not work, and you should switch it off. Note that you
+will have to reposition child windows yourself, if physical scrolling
+is disabled.
\wxheading{Parameters}
\subsection{Unicode support in wxWindows}
-In wxWindows, the code fragment froim above should be written instead:
+In wxWindows, the code fragment from above should be written instead:
\begin{verbatim}
- wxChar ch = T('*');
- wxString s = T("Hello, world!");
+ wxChar ch = wxT('*');
+ wxString s = wxT("Hello, world!");
int len = s.Len();
\end{verbatim}
\helpref{wxString}{wxstring} supports Unicode, i.e. it stores iether ANSI or
Unicode strings depending on the mode.
-Finally, there is a special {\tt T()} macro which should enclose all literal
+Finally, there is a special {\tt wxT()} macro which should enclose all literal
strings in the program. As it's easy to see comparing the last fragment with
the one above, this macro expands to nothing in the (usual) ANSI mode and
prefixes {\tt 'L'} to its argument in the Unicode mode.
The important conclusion is that if you use {\tt wxChar} instead of
{\tt char}, avoid using C style strings and use {\tt wxString} instead and
-don't forget to enclose all string literals inside {\tt T()} macro, your
+don't forget to enclose all string literals inside {\tt wxT()} macro, your
program automatically becomes (almost) Unicode compliant!
Just let us state once again the rules:
\begin{itemize}
\item Always use {\tt wxChar} instead of {\tt char}
-\item Always enclose literal string constants in {\tt T()} macro unless
+\item Always enclose literal string constants in {\tt wxT()} macro unless
they're already converted to the right representation (another standard
-wxWindows macro {\tt \_()} does it, so there is no need for {\tt T()} in this
+wxWindows macro {\tt \_()} does it, so there is no need for {\tt wxT()} in this
case) or you intend to pass the constant directly to an external function
which doesn't accept wide-character strings.
\item Use {\tt wxString} instead of C style strings.
\twocolwidtha{5cm}%
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxSIMPLE\_BORDER}}{Displays a thin border around the window. wxBORDER is the old name
-for this style. Windows only. }
+for this style. }
\twocolitem{\windowstyle{wxDOUBLE\_BORDER}}{Displays a double border. Windows only.}
\twocolitem{\windowstyle{wxSUNKEN\_BORDER}}{Displays a sunken border.}
-\twocolitem{\windowstyle{wxRAISED\_BORDER}}{Displays a raised border.}
+\twocolitem{\windowstyle{wxRAISED\_BORDER}}{Displays a raised border. GTK only. }
\twocolitem{\windowstyle{wxSTATIC\_BORDER}}{Displays a border suitable for a static control. Windows only. }
\twocolitem{\windowstyle{wxTRANSPARENT\_WINDOW}}{The window is transparent, that is, it will not receive paint
events. Windows only.}
m_button = new wxButton( this, ID_QUERYPOS, "Query position", wxPoint(10,110) );
- (void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,150) );
+ (void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,150), wxSize(80,-1) );
(void) new wxRadioButton( this, -1, "Disable", wxPoint(10,190) );
}
// Adjust the scrollbars - new version.
-void wxScrolledWindow::AdjustScrollbars(void)
+void wxScrolledWindow::AdjustScrollbars()
{
int w, h;
GetClientSize(&w, &h);
+
+ int oldXScroll = m_xScrollPosition;
+ int oldYScroll = m_yScrollPosition;
if (m_xScrollLines > 0)
{
m_yScrollPosition = 0;
SetScrollbar (wxVERTICAL, 0, 0, 0, FALSE);
}
+
+ if (oldXScroll != m_xScrollPosition)
+ {
+ if (m_xScrollingEnabled)
+ ScrollWindow( m_xScrollPixelsPerLine * (oldXScroll-m_xScrollPosition), 0, (const wxRect *) NULL );
+ else
+ Refresh();
+ }
+
+ if (oldYScroll != m_yScrollPosition)
+ {
+ if (m_yScrollingEnabled)
+ ScrollWindow( 0, m_yScrollPixelsPerLine * (oldYScroll-m_yScrollPosition), (const wxRect *) NULL );
+ else
+ Refresh();
+ }
}
// Default OnSize resets scrollbars, if any