hidrau
asked on
I need a help to transfer a text to a scrollbox creating edits and labes
Hello guys,
I have a text in a memoedit and I have scrollbox. I would like to transfer my text to scrollbox where
each word will turn into in a label or edit inside of my scrollbox.
For exemple
Well, to create all words as label or edit in a scrollbox it is ok for me, I developed the code as you can see over here but I am having a problem, if I change the scrollbox font size, some labels is over to another.
I don't know how to workaround with it, that is, how to consider the font size of my scrollbox and to give
the right space between labels and edits. Esq is a variable where is passed the value of left space.
Take a look at part of my code where my function create the labels and edits
I'd like a help on this
Thanks
Alex
I have a text in a memoedit and I have scrollbox. I would like to transfer my text to scrollbox where
each word will turn into in a label or edit inside of my scrollbox.
For exemple
Well, to create all words as label or edit in a scrollbox it is ok for me, I developed the code as you can see over here but I am having a problem, if I change the scrollbox font size, some labels is over to another.
I don't know how to workaround with it, that is, how to consider the font size of my scrollbox and to give
the right space between labels and edits. Esq is a variable where is passed the value of left space.
Take a look at part of my code where my function create the labels and edits
Function CriaObj(Obj: TWinControl; Esq, Topo, idx :Integer; Word, Tipo: String):Integer;
var
L : TsLabel;
Tam :Integer;
begin
if Tipo = 'Label' then
begin
L:=TsLabel.Create(Self);
L.Parent := Obj;
L.Caption := UpperCase(Word);
If ckDica.Checked Then
Begin
L.Hint := BuscaPalavraDicionario(IdiomaAtivo, Word);
End;
L.Tag := 1;
L.Name := 'L' + IntToStr(idx);
// L.Font.Style := [fsBold];
L.SetBounds(Esq,Topo,100,15);
// L.OnDblClick := TraduzPalavra;
// L.OnMouseDown := LabelExpressao;
Result:=Esq+Canvas.TextWidth(L.Caption)+10;
end
else
begin
SetLength(Edits,ContEdits+1);
Edits[ContEdits]:=TsEdit.Create(Obj);
Edits[ContEdits].Parent:=Obj;
Edits[ContEdits].BorderStyle:=bsSingle;
Edits[ContEdits].Text:='';
// Edits[ContEdits].Font.Style := [fsBold];
Edits[ContEdits].OnEnter := OnEnter;
If ckDica.Checked Then
Begin
Edits[ContEdits].Hint := BuscaPalavraDicionario(IdiomaAtivo, Palavra);
Edits[ContEdits].ShowHint := false;
End;
Edits[ContEdits].Ctl3D := False;
Edits[ContEdits].Tag := ContEdits;
Edits[ContEdits].MaxLength:=Length(Palavra);
Tam:=Canvas.TextWidth(Palavra)+10;
Edits[ContEdits].SetBounds(Esq+3,Topo,Tam,15);
Inc(ContEdits);
Result:=Esq+Tam+10;
End
End;
I'd like a help on this
Thanks
Alex
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sinisav, your answer it is not what I need to do.
When I create the labes and edit in the scrollbox on the fontsize 8, all the labes and edits go on fine.
but when I change the scrollbox fontsize to 10, it starts the error, some labes is being created over another.
if I increase the fontsize, the problem increase.
I need a way to take into account the fontsize of my scrollbox. Please, check the images that is small part of my screen where is the scrollbox with labels.
image1.fw.png
When I create the labes and edit in the scrollbox on the fontsize 8, all the labes and edits go on fine.
but when I change the scrollbox fontsize to 10, it starts the error, some labes is being created over another.
if I increase the fontsize, the problem increase.
I need a way to take into account the fontsize of my scrollbox. Please, check the images that is small part of my screen where is the scrollbox with labels.
image1.fw.png
ASKER
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ugh ... so you need a flowpanel with a scrollbar ?
drat ... it's not descending from TScrollingWinControl
... i'll figure that out tomorrow
drat ... it's not descending from TScrollingWinControl
... i'll figure that out tomorrow
ASKER
Well, I was creating all labels and edits directly on the scrollbox, but flowPanel gives me a right and easy way to create the labels and edits without any calculations. The problem is that I have some long text when created the labels and edits they will go beyond the button of my FlowPanel. With a scrollbox, it creates automatically the vertical scroll-bar.
Did you get it?
Did you get it?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hummm, I didn't think on this possibility. I will try something, let me see.
i was thinking of adding scrollbars to the flowpanel
and optionally resize ... but if you set this to align = alClient and use the form resize the flowpanel should resize accordingly
and optionally resize ... but if you set this to align = alClient and use the form resize the flowpanel should resize accordingly
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello Geert Gruwez,
Yeah, your idea is valid, but I need to adjust it in my program.
Only one flowPanel is not a good idea because the text isn't displayed as
it is in my memoedit. If you see my text, you will notice that is a music and I need
to display it the way it is, that is, Line by Line.
Yeah, your idea is valid, but I need to adjust it in my program.
Only one flowPanel is not a good idea because the text isn't displayed as
it is in my memoedit. If you see my text, you will notice that is a music and I need
to display it the way it is, that is, Line by Line.
ASKER
thanks very much,
all of you helped me to reach the result :)
all of you helped me to reach the result :)
ASKER