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 Button : TLMDDockspeedButton;
const Caption :
String;
const p_fAutoAdjust : Boolean = false) : Boolean;
begin
Result := false;
if SetWindowLong(Button.Control.Handle, GWL_STYLE, GetWindowLong(Button.Control.Handle, GWL_STYLE)
or BS_MULTILINE)> 0
then
begin
Button.Caption := Caption;
Result := true;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
ts:tstringlist;
i:integer;
begin
ts:=tstringlist.Create;
clientdataset1.RecNo:=1;
breaklongstring(Clientdataset1.FieldValues['
Artikel'],ts,8);
i:=ts.Count;
if i=1
then
SetMultiLineCaption(LMDDockspeedbutton1,ts.Strings[0],true);
if i=2
then
SetMultiLineCaption(LMDDockspeedbutton1,ts.Strings[0]+#13#10+ts.Strings[1],true);
if i=3
then
SetMultiLineCaption(LMDDockspeedbutton1,ts.strings[0]+#13#10+ts.strings[1]+#13#10+ts.strings[2],true);
ts.Free;
end;