Rich edit and memo components can contain horizontal or vertical scroll bars, or both, as needed. When word wrapping is enabled, the component needs only a vertical scroll bar. If the user turns off word wrapping, the component might also need a horizontal scroll bar, since text is not limited by the right side of the editor.
procedure TForm.WordWrap1Click(Sender: TObject); begin with Editor do begin WordWrap := not WordWrap; { toggle word wrapping } if WordWrap then ScrollBars := ssVertical { wrapped requires only vertical } else ScrollBars := ssBoth; { unwrapped might need both } WordWrap1.Checked := WordWrap; { check menu item to match property } end; end;
void __fastcall TForm::WordWrap1Click(TObject *Sender) { Editor->WordWrap = !(Editor->WordWrap); // toggle word wrapping if (Editor->WordWrap) Editor->ScrollBars = ssVertical; // wrapped requires only vertical else Editor->ScrollBars = ssBoth; // unwrapped can need both WordWrap1->Checked = Editor->WordWrap; // check menu item to match property }
The rich edit and memo components handle their scroll bars in a slightly different way. The rich edit component can hide its scroll bars if the text fits inside the bounds of the component. The memo always shows scroll bars if they are enabled.
TMemo
TRichEdit
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|