Hi.
Pressing tab while on a Richtext control is not inserting spaces, but instead it is highlighting the full text. How can I change this behavior?
Thank you,
Reinaldo.
Hi.
Pressing tab while on a Richtext control is not inserting spaces, but instead it is highlighting the full text. How can I change this behavior?
Thank you,
Reinaldo.
Reinaldo,
Is the richedit control placed on a dialogbox ?
Yes. Inside a "SysTabControl32" that is inside a Dialog.
Reinaldo,
Please try this:
oRichEdit:nDlgCode = DLGC_WANTALLKEYS
Nope. Didn't do it. Same behavior.
Reinaldo.
Si se te ocurre alguna otra cosa, plis...
Reinaldo,
Estamos investigándo, te contestamos cuanto antes.
Private Sub ctlRichText1_KeyDown(KeyCode As Integer, _
ByVal Shift As Integer)
Dim rtf As RichTextBox
Set rtf = Me!ctlRichText1.Object
If KeyCode = 9 Then ' TAB key was pressed.
' Ignore the TAB key, so focus doesn't
' leave the control
KeyCode = 0
' Replace selected text with the tab character
rtf.SelText = vbTab
End If
End SubDear Mr.Reinaldo,
After reading the code, I assume that the value of the constant vbTab should be Space(4) or Space(5) ( whatever the length occupies in a line when ever we press the TAB key).
The code is just trying to ignore the TAB character and is replacing TAB with VbTab (VbTab should be character type, filled with blank space)
Regards
Anser
//richEdit1 of type TRichEdit
with richEdit1 do
begin
//move caret to end
SelStart := GetTextLen;
//add one unformatted line
SelText := 'This is the first line' + #13#10;
//add some normal font text
SelText := 'Formatted lines in RichEdit' + #13#10;
//bigger text
SelAttributes.Size := 13;
//add bold + red
SelAttributes.Style := [fsBold];
SelAttributes.Color := clRed;
SelText := 'About';
//only bold
SelAttributes.Color := clWindowText;
SelText := ' Delphi ';
//add italic + blue
SelAttributes.Style := [fsItalic];
SelAttributes.Color := clBlue;
SelText := 'Programming';
//new line
SelText := #13#10;
//add normal again
SelAttributes.Size := 8;
SelAttributes.Color := clGreen;
SelText := 'think of AddFormattedLine custom procedure...';
end;...
RELoadRTF( ortf:hWnd, chr( 9 ) + Chr( 0 ), SF_TEXT )
FwKeyboard( ortf, VK_RIGHT ) //otherwise all text is highlighted. don't know whyReinaldo,
Maybe this will help:
http://support.microsoft.com/kb/170141
Have you tried using bKeyDown?
James
*-------------------------------------------------------------------------------------------------------------------------------
METHOD KeyDown( nKey, nFlags ) CLASS RchEdt
logfile( "trace.log", { "Keydown", nKey } )
::PostMsg( FM_CHANGE ) //FM_HIGHLIGHT )
Return Nil //Super:KeyDown( nKey, nFlags )METHOD KeyChar( nKey, nFlags ) CLASS TRichEdit
if ::lReadOnly .and. ! GetKeyState( VK_ESCAPE )
return 0
endif
if nKey == VK_TAB // added by mmercado
Return 0
endif
Super:KeyChar( nKey, nFlags )
::PostMsg( FM_CHANGE )
if ::lHighlight
::PostMsg( FM_HIGHLIGHT )
endif
return nilMETHOD KeyDown( nKey, nFlags ) CLASS TRichEdit
if ( nKey == VK_INSERT .and. GetKeyState( VK_SHIFT ) .or. ;
nKey == Asc( "V" ) .and. GetKeyState( VK_CONTROL ) )
if ! ::lReadOnly
::Paste()
::PostMsg( FM_CHANGE )
endif
return 0
endif
if ::lReadOnly
if nKey == VK_BACK .or. nKey == VK_DELETE .or. nKey == VK_RETURN
return 0
endif
endif
if nKey == VK_TAB // added by mmercado
::insertRtf( Chr( 9 ) )
::PostMsg( FM_CHANGE )
Return 0
endif
Super:KeyDown( nKey, nFlags )
::PostMsg( FM_CHANGE )
if ::lHighlight
if nKey == VK_DELETE .or. nKey == VK_BACK
::PostMsg( FM_HIGHLIGHT )
endif
endif
return nilManuel --Hola. es grato ver tu respuesta.
I have created a reduced self-contained sample that demonstrates how the tab key is handled in this particular situation by FW. If any of you would like to help, I can send the sample via email. BTW, I'm willing to pay for the solution.
The self-contained-reduced sample is a single .prg + .rc that can be compiled with the compile batch command in fw/samples.
Thank you all.
Reinaldo.