Jump to content


Jon G

Member Since 06 Oct 2009
Offline Last Active Apr 06 2011 04:20 AM
-----

Posts I've Made

In Topic: NextGrid OnCellDraw

06 April 2011 - 04:20 AM

QUOTE (Boki (Berg) @ Apr 5 2011, 10:33 PM) <{POST_SNAPBACK}>
Maybe for your need you may use OnApplyCell event, but you will need to have actual rows in grid. This mean that you can't escape from loading grid with records.


Thanks so much for your prompt help as always!

In this case what I needed was NxVirtualColumn type. It did exactly what I needed.

For future lurkers: NxVirtualColumn has an event that yields aRow, aCol where the programmer can specify a WideString and the grid will draw it. (See http://dn.bergsoft.n...mn-tutorial.htm )

if I needed to both draw text and a picture I would probably use OnCustomDrawCell
( See http://dn.bergsoft.n...in-nextgrid.htm ).

Thanks again Boki!

In Topic: vertical rotated text in column headers

02 December 2010 - 07:18 AM

QUOTE (Boki (Berg) @ Oct 12 2010, 07:36 AM) <{POST_SNAPBACK}>
Hello JonG,

Sure, I will integrate it.

Best regards


Hi Boki,

You have released another version of NextSuite.

Please please integrate my suggested changes (or your own version) to NXSharedCommon.pas so that I don't have to choose whether to keep up with the latest versions.

Thanks,
JonG


In Topic: vertical rotated text in column headers

16 October 2010 - 01:40 AM

QUOTE (Boki (Berg) @ Oct 12 2010, 08:36 AM) <{POST_SNAPBACK}>
Hello JonG,

Sure, I will integrate it.

Best regards


This is only tested for TNxGrid.

In NxSharedCommon.pas:

CODE
procedure DrawVerticalText(Canvas: TCanvas; Rect: TRect; Text: string);
var
  LogRec: TLOGFONT;
  OldFont, NewFont: HFONT;
  Flags: Integer;
  i : Integer;
  SL : TStringlist;
  S : String;
  TH : Integer;
begin
  Flags := DT_NOPREFIX or DT_BOTTOM or DT_EXTERNALLEADING or DT_SINGLELINE;
  with Canvas do
  begin
    Brush.Style := bsClear;
    GetObject(Font.Handle, SizeOf(LogRec), @LogRec);
    LogRec.lfEscapement := 900;
    LogRec.lfOutPrecision := OUT_TT_ONLY_PRECIS;
    NewFont := CreateFontIndirect(LogRec);
    OldFont := SelectObject(Canvas.Handle, NewFont);
    if Pos(#13,Text) = 0 then
      DrawText(Canvas.Handle, PAnsiChar(Text), Length(Text), Rect, Flags)
    else
    begin
      // Windows.DrawText has a bug that can't handle multiple lines in non-horizontal orientation.
      // See http://msdn.microsoft.com/en-us/library/dd162498(VS.85).aspx
      SL := TStringlist.Create;
      SL.Text := Text;
      TH := TextHeight(Text);
      For i := 0 to SL.Count - 1 do
      begin
        S := SL.Strings[i];
        DrawText(Canvas.Handle, PAnsiChar(S), Length(S), Rect, Flags);
        Inc(Rect.Left,TH);
      end;
      SL.Free;
    end;
    NewFont := SelectObject(Canvas.Handle,OldFont);
    DeleteObject(NewFont);
  end;
end;

In Topic: vertical rotated text in column headers

12 October 2010 - 03:14 AM

QUOTE (Boki (Berg) @ Oct 9 2010, 01:17 PM) <{POST_SNAPBACK}>
Hello,

This is unfortunately a issue of DrawText function in Windows API. I don't know why it won't work as expected sad.gif

Best regards


If I fix it, can I get my changes included in your source? I don't want to have to update my source every time you update yours.

Best regards,
- JonG

In Topic: vertical rotated text in column headers

09 October 2010 - 06:07 PM

QUOTE (Boki (Berg) @ Jul 26 2010, 08:24 PM) <{POST_SNAPBACK}>
Set Orientation property of Column.Header to hoVertical


Multiline does not work correctly with Column.Header set to hoVertical.

Could you have a look at that?

- JonG