Procedure BreakLongString (
Const aString :
String; aStringList : TStringList; aMaxLength : Integer);
Var
X,X1, XEnd : Integer;
Begin
X := 1;
XEnd := Length (aString);
While X < XEnd
Do Begin
X1 := Min (Xend, X+8);
If X1<XEnd
Then Begin
While (X1>X)
And (aString[X1]<>'
')
Do Dec (X1);
If X1 = X
Then X1 := X + 8;
End;
aStringList.Add(Copy (aString,X,X1-X+1));
X := X1+1;
End
End;
function SetMultiLineCaption(
const p_Button : TButton;
const p_sCaption :
String;
const p_fAutoAdjust : Boolean = false) : Boolean;
begin
Result := false;
if SetWindowLong(p_Button.Handle, GWL_STYLE, GetWindowLong(p_Button.Handle, GWL_STYLE)
or BS_MULTILINE)> 0
then
begin
p_Button.Caption := p_sCaption;
Result := true;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
ts:Tstringlist;
j:integer;
begin
ts:=tstringlist.Create;
form1.clientdataset1.recno:=1;
breaklongstring(form1.ClientDataSet1.FieldValues['
Warengruppe'],ts,8);
j:=ts.Count;
if j=1
then
SetMultiLineCaption(form1.LMDDockspeedbutton1,ts.Strings[0],true);
if j=2
then
SetMultiLineCaption(form1.LMDDockspeedbutton1,ts.Strings[0]+#13#10+ts.Strings[1],true);
if j=3
then
SetMultiLineCaption(form1.LMDDockspeedbutton1,ts.strings[0]+#13#10+ts.strings[1]+#13#10+ts.strings[2],true);
ts.Free;
end;