Auto-Adjust ?
#1
Posted 21 February 2007 - 01:31 PM
#2
Posted 08 March 2007 - 09:55 PM
#3
Posted 08 March 2007 - 10:06 PM
I am sorry, it is not finished. It really need a time.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#4
Posted 10 March 2007 - 12:20 PM
#5
Posted 27 March 2007 - 05:52 PM
function GetCellTextSize(N: TNextDBGrid; ACol, ARow: Integer): TSize;
Const
Params: TDrawTextParams =(Cbsize: 20; iTabLength: 0; iLeftMargin: 2; iRightMargin: 8; uiLengthDrawn: 0);
var
r: TRect;
ws: widestring;
begin
ws := N.Cells[ACol, ARow];
r := N.GetCellRect(ACol, ARow);
if (N.Columns[ACol].WrapKind = wkWordWrap) then
Result.cy := DrawTextExW(N.Canvas.Handle, PWidechar(ws), Length(ws), r, DT_LEFT or DT_WORDBREAK or DT_NOPREFIX or DT_CALCRECT, @params) + 6
else
Result.cy := DrawTextExW(N.Canvas.Handle, PWidechar(ws), Length(ws), r, DT_LEFT or DT_SINGLELINE or DT_NOPREFIX or DT_CALCRECT, @params) + 6;
if Result.cy < N.RowSize then
Result.cy := N.RowSize;
Result.cx := r.Right - r.Left;
end;
#6
Posted 27 March 2007 - 06:33 PM
I will try it now. Thank you.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#7
Posted 05 May 2007 - 09:21 PM
Can one hope that this will be to integrate in the next version !
#8
Posted 08 May 2007 - 08:53 PM
I was try to integrate but I have found some problems with this procedure and this stoped me. I was decide to not integrate it yet.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#9
Posted 09 May 2007 - 11:52 AM
I was try to integrate but I have found some problems with this procedure and this stoped me. I was decide to not integrate it yet.
regards
Ok, and this is very bad new for me...
While waiting, it would be possible to include the TList as well as the routines which correspond in the NextDBGrid, to be able them to call, that even manually would enable me to work well with this superb grid which you have realize !
I suppose that it is the automatic adjustment the height which poses a problem to you and not to put the list in the component…
Me, for example I am on a program which uses more than 20 NextDBgrids and duty to manage the 20 TLists in parallel, it is not simple, especially when it are treated by actions.
#10
Posted 14 June 2007 - 02:47 PM
#11
Posted 14 June 2007 - 03:22 PM
AutoSize feature is realy hard to add, and I have try to add it quickly after some testings but it require a lot more time.
I only may say that I will leave one week only for this feature, because I will maybe need to rewrite my own DrawText procedure because DrawText from Windows have bugs with returning text height in some situations.
Maybe some features are to loong on to-do list, but every time I finish some requested feature and fix bugs.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#12
Posted 23 June 2007 - 08:41 PM
At home, with this new routine, I do not have any more a concern of calculation row height:
var
DC: HDC;
Rect: TRect;
C: TBitmap;
WordWrapParams: integer;
begin
C := TBitmap.create;
if police <> nil then
C.canvas.Font := police;
Rect.Left := 0;
Rect.Top :=0;
Rect.Right :=AWidth;
Rect.Bottom :=0;
DC := GetDC(0);
C.Canvas.Handle := DC;
WordWrapParams := 0;
if (AWidth <> 0) then WordWrapParams := DT_NOPREFIX or DT_WORDBREAK;
DrawText(C.Canvas.Handle, PChar(Phrase), -1, Rect, WordWrapParams or (DT_EXPANDTABS or DT_CALCRECT));
C.Canvas.Handle := 0;
ReleaseDC(0, DC);
Result.X := Rect.Right - Rect.Left;
Result.Y := (Rect.Bottom - Rect.Top) + 6;
if (Result.Y < AMinimum) then
Result.Y := AMinimum;
C.Free;
end;
procedure GridAutoHeight(G: TNextDBGrid);
var
I, U, A: integer;
begin
// This is array of TList...
frmMainWICS.iHeight[G.Tag].Clear;
if (G.RowCount > 0) then
begin
for I := 0 to G.RowCount - 1 do
begin
A := 0;
for U := 0 to G.Columns.Count - 1 do
if (G.Columns[U].ColumnType = ctString) then
// New solution
A := Max(A, CalculTextSize(G.Cells[U, I], (G.GetCellRect(U, I).Right - G.GetCellRect(U, I).Left), G.RowSize, G.Columns[U].Font).Y);
// Old solution
// A := Max(A, GetCellTextSize(G, U, I));
SetSize(frmMainWICS.iHeight[G.Tag], I, A);
end;
G.Invalidate;
G.RefreshRange(0, G.RowCount);
end;
end;
#13
Posted 23 June 2007 - 09:41 PM
Can you please attach and one small example with this code. Maybe I can optimize it.
Thank you.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#14
Posted 23 June 2007 - 11:18 PM
Why TNextGRid.ChangeRowHeight event not dispaly in Windows Events property's in last NextSuite ?
Attached Files
#15
Posted 23 June 2007 - 11:37 PM
Thank you, I will test it now.
This event only exist in NextDBGrid, but I will add it in NextGrid too.
Best regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#16
Posted 25 June 2007 - 02:07 PM
My code is pressed on a TNextDBGrid which use Unicode (TNTWare).
In my project this routine gives me whole satisfaction.
#17
Posted 25 June 2007 - 02:13 PM
Maybe your code can help me somehow. I will try to retreive CellHeight immidiatelly when cell is drawn.
Thanks again, I have add ChangeRowHeight event into NextGrid too.
Best regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#18
Posted 28 January 2008 - 03:38 PM
I have a problem of calculating the height if I use TNxHTMLColumn !
#19
Posted 28 January 2008 - 04:10 PM
Calculating height of html column is not posible at the moment. I will try to add it, but it may be quite hard because content need to be parsed first and then calculated.
Best regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#20
Posted 06 February 2008 - 01:35 PM
var
DC: HDC;
Rect: TRect;
C: TBitmap;
WordWrapParams: integer;
IsUnicodeSupported: boolean;
begin
C := TBitmap.create;
// This is for compatibility in TNextGrid...
IsUnicodeSupported := (Win32Platform = VER_PLATFORM_WIN32_NT);
C.canvas.Font := N.Columns[ACol].Font;
Rect.Left := 0;
Rect.Top := 0;
Rect.Right := (N.GetCellRect(ACol, ARow).Right - N.GetCellRect(ACol, ARow).Left) - 5;
Rect.Bottom := 0;
DC := GetDC(0);
C.Canvas.Handle := DC;
WordWrapParams := 0;
if (Rect.Right <> 0) then
WordWrapParams := DT_NOPREFIX or DT_WORDBREAK or DT_WORD_ELLIPSIS;
if (IsUnicodeSupported) then
begin
if (N.Columns[ACol] is TNxDBHtmlColumn) then
DrawTextW(C.Canvas.Handle, PWideChar(RemoveAllTagsHTML(N.Cells[ACol, ARow])), -1, Rect, WordWrapParams or (DT_EXPANDTABS or DT_CALCRECT))
else
DrawTextW(C.Canvas.Handle, PWideChar(N.Cells[ACol, ARow]), -1, Rect, WordWrapParams or (DT_EXPANDTABS or DT_CALCRECT));
end
else
DrawText(C.Canvas.Handle, PChar(string(N.Cells[ACol, ARow])), -1, Rect, WordWrapParams or (DT_EXPANDTABS or DT_CALCRECT));
C.Canvas.Handle := 0;
ReleaseDC(0, DC);
Result := (Rect.Bottom - Rect.Top) + 6;
if (Result < N.RowSize) then
Result := N.RowSize;
C.Free;
end;
And RemoveAllTagsHTML procedure :
var
IdX: Integer;
IdY: Integer;
ForceExit: Boolean;
begin
Result := FromWhere;
ForceExit := False;
repeat
IdX := Pos('<', Result);
IdY := Pos('>', Result);
if ((IdX > 0) and (IdY > IdX)) then
Result := Copy(Result, 1, (IdX - 1)) + Copy(Result, (IdY + 1), MaxInt)
else
ForceExit := True;
until ((IdX = 0 ) Or (IdY = 0) Or (ForceExit));
end;
Did you an idea for this ?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users