void wxTextCtrl::SetSelection(long from, long to)
{
- // if from and to are both -1, it means (in wxWindows) that all text should
+ // if from and to are both -1, it means (in wxWidgets) that all text should
// be selected - translate into Windows convention
if ( (from == -1) && (to == -1) )
{
break;
case WXK_TAB:
- // always produce navigation event -- even if we process TAB
- // ourselves the fact that we got here means that the user code
- // decided to skip processing of this TAB -- probably to let it
- // do its default job.
-
// ok, so this is getting absolutely ridiculous but I don't see
// any other way to fix this bug: when a multiline text control is
// inside a wxFrame, we need to generate the navigation event as
// the right thing to do would, of course, be to understand what
// the hell is IsDialogMessage() doing but this is beyond my feeble
// forces at the moment unfortunately
- if ( FindFocus() == this )
+ if ( !(m_windowStyle & wxTE_PROCESS_TAB))
{
- wxNavigationKeyEvent eventNav;
- eventNav.SetDirection(!event.ShiftDown());
- eventNav.SetWindowChange(event.ControlDown());
- eventNav.SetEventObject(this);
-
- if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
- return;
+ if ( FindFocus() == this )
+ {
+ int flags = 0;
+ if (!event.ShiftDown())
+ flags |= wxNavigationKeyEvent::IsForward ;
+ if (event.ControlDown())
+ flags |= wxNavigationKeyEvent::WinChange ;
+ if (Navigate(flags))
+ return;
+ }
+ }
+ else
+ {
+ // Insert tab since calling the default Windows handler
+ // doesn't seem to do it
+ WriteText(wxT("\t"));
}
break;
}
cf.dwEffects |= CFE_UNDERLINE;
}
- // strikeout fonts are not supported by wxWindows
+ // strikeout fonts are not supported by wxWidgets
}
if ( style.HasTextColour() )
if (style.HasLeftIndent())
{
- pf.dwMask |= PFM_STARTINDENT;
+ pf.dwMask |= PFM_STARTINDENT | PFM_OFFSET;
// Convert from 1/10 mm to TWIPS
pf.dxStartIndent = (int) (((double) style.GetLeftIndent()) * mm2twips / 10.0) ;
-
- // TODO: do we need to specify dxOffset?
+ pf.dxOffset = (int) (((double) style.GetLeftSubIndent()) * mm2twips / 10.0) ;
}
if (style.HasRightIndent())
// do format the selection
(void) ::SendMessage(GetHwnd(), EM_GETPARAFORMAT, 0, (LPARAM) &pf) ;
- style.SetLeftIndent( (int) ((double) pf.dxStartIndent * twips2mm * 10.0) );
+ style.SetLeftIndent( (int) ((double) pf.dxStartIndent * twips2mm * 10.0), (int) ((double) pf.dxOffset * twips2mm * 10.0) );
style.SetRightIndent( (int) ((double) pf.dxRightIndent * twips2mm * 10.0) );
if (pf.wAlignment == PFA_CENTER)
size_t i;
for (i = 0; i < (size_t) pf.cTabCount; i++)
{
- tabStops[i] = (int) ((double) (pf.rgxTabs[i] & 0xFFFF) * twips2mm * 10.0) ;
+ tabStops.Add( (int) ((double) (pf.rgxTabs[i] & 0xFFFF) * twips2mm * 10.0) );
}
if ( changeSel )