From 5d5cdec72ad9b2d89d67a901399aee1a92b72c2f Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 18 Mar 2004 22:26:24 +0000 Subject: [PATCH] fixed grids TComboBox from Jesus git-svn-id: trunk@5325 - --- lcl/grids.pas | 160 ++++++++++++++++++++------- lcl/interfaces/win32/win32object.inc | 12 +- 2 files changed, 127 insertions(+), 45 deletions(-) diff --git a/lcl/grids.pas b/lcl/grids.pas index fc43dabe44..ec66b515a1 100644 --- a/lcl/grids.pas +++ b/lcl/grids.pas @@ -290,6 +290,7 @@ type FOnSelection: TOnSelectEvent; FOnTopLeftChanged: TNotifyEvent; FSkipUnselectable: Boolean; + FGSMHBar, FGSMVBar: Integer; // Scrollbar's metrics procedure AdjustCount(IsColumn:Boolean; OldValue, NewValue:Integer); procedure CacheVisibleGrid; @@ -351,6 +352,7 @@ type procedure WriteColWidths(Writer: TWriter); procedure WriteRowHeights(Writer: TWriter); procedure WMEraseBkgnd(var message: TLMEraseBkgnd); message LM_ERASEBKGND; + procedure WMGetDlgCode(var Msg: TLMNoParams); message LM_GETDLGCODE; procedure WMSize(var Msg: TLMSize); message LM_SIZE; procedure WMChar(var message: TLMChar); message LM_CHAR; protected @@ -412,7 +414,7 @@ type procedure SaveContent(cfg: TXMLConfig); virtual; procedure ScrollBarRange(Which:Integer; IsVisible:boolean; aRange: Integer); procedure ScrollBarPosition(Which, Value: integer); - function ScrollBarIsVisible(Which:Integer): Boolean; + //function ScrollBarIsVisible(Which:Integer): Boolean; procedure ScrollBarPage(Which: Integer; aPage: Integer); procedure ScrollBarShow(Which: Integer; aValue: boolean); function ScrollBarAutomatic(Which: TScrollStyle): boolean; virtual; @@ -735,11 +737,70 @@ begin I2:=Tmp; end; +{$ifdef GridTraceMsg} +function TransMsg(const S: String; const TheMsg: TLMessage): String; +var + hex: string; +begin + with TheMsg do begin + hex:= S + '['+IntToHex(msg, 8)+'] W='+IntToHex(WParam,8)+' L='+IntToHex(LParam,8)+' '; + case Msg of + CM_BASE..CM_MOUSEWHEEL: + case Msg of + CM_MOUSEENTER: WriteLn(hex, 'CM_MOUSEENTER'); + CM_MOUSELEAVE: WriteLn(hex, 'CM_MOUSELEAVE'); + CM_TEXTCHANGED: WriteLn(hex, 'CM_TEXTCHANGED'); + CM_PARENTCTL3DCHANGED: WriteLn(hex, 'CM_PARENTCTL3DCHANGED'); + CM_UIACTIVATE: WriteLn(hex, 'CM_UIACTIVATE'); + CM_CONTROLLISTCHANGE: WriteLn(hex, 'CM_CONTROLLISTCHANGE'); + + CM_PARENTCOLORCHANGED: WriteLn(hex, 'CM_PARENTCOLORCHANGED'); + CM_PARENTFONTCHANGED: WriteLn(hex, 'CM_PARENTFONTCHANGED'); + CM_PARENTSHOWHINTCHANGED: WriteLn(hex, 'CM_PARENTSHOWHINTCHANGED'); + CM_PARENTBIDIMODECHANGED: WriteLn(hex, 'CM_PARENTBIDIMODECHANGED'); + CM_CONTROLCHANGE: WriteLn(Hex, 'CM_CONTROLCHANGE'); + CM_SHOWINGCHANGED: WriteLn(Hex, 'CM_SHOWINGCHANGED'); + CM_VISIBLECHANGED: WriteLn(Hex, 'CM_VISIBLECHANGED'); + else WriteLn(Hex, 'CM_BASE + ', Msg - CM_BASE); + end; + else + case Msg of + //CN_BASE MESSAGES + CN_COMMAND: WriteLn(hex, 'LM_CNCOMMAND'); + // NORMAL MESSAGES + LM_SETFOCUS: WriteLn(hex, 'LM_SetFocus'); + LM_LBUTTONDOWN: WriteLn(hex, 'LM_MOUSEDOWN'); + LM_LBUTTONUP: WriteLn(hex, 'LM_LBUTTONUP'); + LM_RBUTTONDOWN: WriteLn(hex, 'LM_RBUTTONDOWN'); + LM_RBUTTONUP: WriteLn(hex, 'LM_RBUTTONUP'); + LM_GETDLGCODE: WriteLn(hex, 'LM_GETDLGCODE'); + LM_KEYDOWN: WriteLn(hex, 'LM_KEYDOWN'); + LM_KEYUP: WriteLn(hex, 'LM_KEYUP'); + LM_CAPTURECHANGED: WriteLn(hex, 'LM_CAPTURECHANGED'); + LM_ERASEBKGND: WriteLn(hex, 'LM_ERASEBKGND'); + LM_KILLFOCUS: WriteLn(hex, 'LM_KILLFOCUS'); + LM_CHAR: WriteLn(hex, 'LM_CHAR'); + LM_SHOWWINDOW: WriteLn(hex, 'LM_SHOWWINDOW'); + LM_SIZE: WriteLn(hex, 'LM_SIZE'); + LM_WINDOWPOSCHANGED: WriteLn(hex, 'LM_WINDOWPOSCHANGED'); + LM_HSCROLL: WriteLn(hex, 'LM_HSCROLL'); + LM_VSCROLL: WriteLn(hex, 'LM_VSCROLL'); + + LM_MOUSEMOVE: ;//WriteLn(hex, 'LM_MOUSEMOVE'); + LM_MOUSEWHEEL: WriteLn(Hex, 'LM_MOUSEWHEEL'); + else WriteLn(hex, GetMessageName(Msg)); + end; + end; + end; +end; +{$Endif GridTraceMsg} + { TCustomGrid } function TCustomGrid.Getrowheights(Arow: Integer): Integer; begin - Result:=Integer(FRows[aRow]); + if aRow(Integer(AccumWidth[Result])+GetColWidths(Result)-1) do Inc(Result); + Rest:=Offset; if Result<>0 then Rest:=Offset-Integer(AccumWidth[Result]); @@ -2372,7 +2451,7 @@ begin if not FGCache.ValidGrid then Exit; if not (ssLeft in Shift) then Exit; - //if csDesigning in componentState then Exit; + if csDesigning in componentState then Exit; {$IfDef dbgFocus} WriteLn('MouseDown INIT'); {$Endif} @@ -2408,7 +2487,6 @@ begin if Not (csDesigning in componentState) then begin fGridState:=gsSelecting; FSplitter:=MouseToCell(Point(X,Y)); - if Not Focused then setFocus; if not (goEditing in Options) then begin @@ -3419,6 +3497,8 @@ begin FRows:=TList.Create; FGCache.AccumWidth:=TList.Create; FGCache.AccumHeight:=TList.Create; + FGSMHBar := GetSystemMetrics(SM_CYHSCROLL); + FGSMVBar := GetSystemMetrics(SM_CXVSCROLL); inherited Create(AOwner); //AutoScroll:=False; FDefaultDrawing := True; diff --git a/lcl/interfaces/win32/win32object.inc b/lcl/interfaces/win32/win32object.inc index 5f0764bef4..c24448b668 100644 --- a/lcl/interfaces/win32/win32object.inc +++ b/lcl/interfaces/win32/win32object.inc @@ -927,12 +927,10 @@ activate_time : the time at which the activation event occurred. case TControl(Sender).FCompStyle of csComboBox: begin - SendMessage(Handle, CB_SETEDITSEL, 0, - MakeLParam(Word(Integer(Data)), High(Word))); + SendMessage(Handle, CB_SETEDITSEL, 0, MakeLParam(integer(Data), integer(Data))); end; csEdit: begin - //WriteLn('LM_SETSELSTART: Start=',Integer(Data)); SendMessage(Handle, EM_SETSEL, Windows.WParam(Data), Windows.LParam(Data)); end; end; @@ -943,13 +941,14 @@ activate_time : the time at which the activation event occurred. Case TControl(Sender).FCompStyle of csComboBox: begin - Windows.SendMessage(Handle, CB_SETCURSEL, Windows.WParam(Data), 0); + Windows.SendMessage(Handle, CB_GETEDITSEL, Windows.Wparam(@i), Windows.LParam(@Num)); + Num := i + Integer(Data); + Windows.SendMessage(Handle, CB_SETEDITSEL, 0, MakeLParam( i, Num )); end; csEdit: begin Windows.SendMessage(Handle, EM_GETSEL, Windows.Wparam(@i), Windows.LParam(@Num)); Num := i + Integer(Data); - //WriteLn('LM_SETSELLEN: Start=',i, ' End= ',Num, 'Length=',Integer(Data)); Windows.SendMessage(Handle, EM_SETSEL, Windows.WParam(i), Windows.LParam(Num)); end; end; @@ -3025,6 +3024,9 @@ End; { $Log$ + Revision 1.183 2004/03/18 22:26:24 mattias + fixed grids TComboBox from Jesus + Revision 1.182 2004/03/07 12:55:53 micha don't create window for image