From: Remko B. <rem...@us...> - 2004-08-29 17:37:33
|
Update of /cvsroot/jvcl/dev/JVCL3/run In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1649 Modified Files: JvToolEdit.pas Log Message: o TJvPopupWindow not form but JvExCustomControl. o Support for not immediately giving the popup window focus. Index: JvToolEdit.pas =================================================================== RCS file: /cvsroot/jvcl/dev/JVCL3/run/JvToolEdit.pas,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** JvToolEdit.pas 24 Aug 2004 12:44:58 -0000 1.140 --- JvToolEdit.pas 29 Aug 2004 17:37:24 -0000 1.141 *************** *** 52,55 **** --- 52,58 ---- Qt, QComboEdits, JvQExComboEdits, QWindows, {$ENDIF VisualCLX} + {$IFDEF VCL} + JvExControls, + {$ENDIF} JvSpeedButton, JvTypes, JvExMask, JvExForms, JvButton; *************** *** 58,61 **** --- 61,66 ---- DefEditBtnWidth = 21; + CM_POPUPCLOSEUP = CM_BASE + $0300; // arbitrary value + type TFileExt = type string; *************** *** 64,68 **** --- 69,78 ---- TPopupAlign = (epaRight, epaLeft); + {$IFDEF VisualCLX} TJvPopupWindow = class(TJvExCustomForm) + {$ENDIF} + {$IFDEF VCL} + TJvPopupWindow = class(TJvExCustomControl) + {$ENDIF} private FEditor: TWinControl; *************** *** 70,75 **** --- 80,88 ---- {$IFDEF VCL} procedure WMMouseActivate(var Msg: TMessage); message WM_MOUSEACTIVATE; + procedure WMActivate(var Msg: TWMActivate); message WM_ACTIVATE; {$ENDIF VCL} protected + FActiveControl: TWinControl; + FIsFocusable: Boolean; {$IFDEF VCL} procedure CreateParams(var Params: TCreateParams); override; *************** *** 90,93 **** --- 103,111 ---- procedure Hide; procedure Show(Origin: TPoint); virtual; // Polaris + { Determines the ctrl that receives the keyboard input if the dropdown + window is showing, but the combo edit still has focus } + property ActiveControl: TWinControl read FActiveControl; + { Determines whether the popup window may be activated } + property IsFocusable: Boolean read FIsFocusable; property OnCloseUp: TCloseUpEvent read FCloseUp write FCloseUp; end; *************** *** 235,238 **** --- 253,257 ---- {$IFDEF VCL} + procedure CMWantSpecialKey(var Msg: TCMWantSpecialKey); message CM_WANTSPECIALKEY; procedure CMBiDiModeChanged(var Msg: TMessage); message CM_BIDIMODECHANGED; procedure CMCancelMode(var Msg: TCMCancelMode); message CM_CANCELMODE; *************** *** 240,243 **** --- 259,263 ---- procedure CNCtlColor(var Msg: TMessage); message CN_CTLCOLOREDIT; procedure WMPaint(var Msg: TWMPaint); message WM_PAINT; // RDB + procedure CMPopupCloseup(var Msg: TMessage); message CM_POPUPCLOSEUP; {$IFDEF JVCLThemesEnabled} procedure WMNCPaint(var Msg: TWMNCPaint); message WM_NCPAINT; *************** *** 262,265 **** --- 282,288 ---- {$ENDIF VisualCLX} {$ENDIF COMPILER6_UP} + {$IFDEF VCL} + procedure WndProc(var Msg: TMessage); override; + {$ENDIF VCL} procedure DoClearText; override; procedure DoClipboardCut; override; *************** *** 291,294 **** --- 314,318 ---- function GetPopupValue: Variant; virtual; function GetReadOnly: Boolean; virtual; + function GetSettingCursor: Boolean; procedure AcceptValue(const Value: Variant); virtual; procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override; *************** *** 315,318 **** --- 339,343 ---- procedure PopupChange; virtual; procedure PopupCloseUp(Sender: TObject; Accept: Boolean); virtual; //virtual Polaris + procedure AsyncPopupCloseUp(Accept: Boolean); virtual; procedure PopupDropDown(DisableEdit: Boolean); virtual; procedure SetClipboardCommands(const Value: TJvClipboardCommands); override; // RDB *************** *** 361,364 **** --- 386,390 ---- property PopupVisible: Boolean read GetPopupVisible; property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False; + property SettingCursor: Boolean read GetSettingCursor; property ShowButton: Boolean read GetShowButton write SetShowButton default True; property OnEnabledChanged: TNotifyEvent read FOnEnabledChanged write FOnEnabledChanged; *************** *** 1048,1052 **** RTLConsts, {$ENDIF HAS_UNIT_RTLCONSTS} ! Math, Consts, {$IFDEF MSWINDOWS} ShellAPI, --- 1074,1078 ---- RTLConsts, {$ENDIF HAS_UNIT_RTLCONSTS} ! Math, Consts, MaskUtils, {$IFDEF MSWINDOWS} ShellAPI, *************** *** 1055,1059 **** JvBrowseFolder, ActiveX, {$ENDIF VCL} ! JvExControls, JvPickDate, JvJCLUtils, JvJVCLUtils, JvThemes, JvResources, JvConsts, JvFinalize; --- 1081,1088 ---- JvBrowseFolder, ActiveX, {$ENDIF VCL} ! {$IFDEF VisualClx} ! JvExControls, ! {$ENDIF} ! JvPickDate, JvJCLUtils, JvJVCLUtils, JvThemes, JvResources, JvConsts, JvFinalize; *************** *** 1070,1076 **** type TCustomEditAccessProtected = class(TCustomEdit); ! TCustomFormAccessProtected = class(TCustomForm); TWinControlAccessProtected = class(TWinControl); const sDirBmp = 'JV_SEDITBMP'; { Directory editor button glyph } --- 1099,1119 ---- type TCustomEditAccessProtected = class(TCustomEdit); ! TCustomFormAccessProtected = class(TCustomForm); TWinControlAccessProtected = class(TWinControl); + TCustomMaskEditAccessPrivate = class(TCustomEdit) + private + // Do not remove these fields, although they are not used. + FEditMask: TEditMask; + FMaskBlank: Char; + FMaxChars: Integer; + FMaskSave: Boolean; + FMaskState: TMaskedState; + FCaretPos: Integer; + FBtnDownX: Integer; + FOldValue: string; + FSettingCursor: Boolean; + end; + const sDirBmp = 'JV_SEDITBMP'; { Directory editor button glyph } *************** *** 1696,1700 **** {$IFDEF VCL} ! //=== TAutoCompleteSource ==================================================== {$IFDEF COMPILER7_UP} --- 1739,1743 ---- {$IFDEF VCL} ! //=== { TAutoCompleteSource } ================================================ {$IFDEF COMPILER7_UP} *************** *** 2017,2020 **** --- 2060,2068 ---- end; + procedure TJvCustomComboEdit.AsyncPopupCloseUp(Accept: Boolean); + begin + PostMessage(Handle, CM_POPUPCLOSEUP, Ord(Accept), 0); + end; + function TJvCustomComboEdit.BtnWidthStored: Boolean; begin *************** *** 2070,2073 **** --- 2118,2141 ---- end; + {$ENDIF VCL} + + {$IFDEF VCL} + procedure TJvCustomComboEdit.CMPopupCloseup(var Msg: TMessage); + begin + PopupCloseUp(Self, Boolean(Msg.WParam)); + end; + {$ENDIF VCL} + + {$IFDEF VCL} + procedure TJvCustomComboEdit.CMWantSpecialKey(var Msg: TCMWantSpecialKey); + begin + inherited; + { Ignore tabs when popup is visible } + if PopupVisible and (Msg.CharCode = VK_TAB) then Msg.Result := 1; + end; + {$ENDIF VCL} + + {$IFDEF VCL} + procedure TJvCustomComboEdit.CNCtlColor(var Msg: TMessage); var *************** *** 2230,2237 **** procedure TJvCustomComboEdit.DoKillFocus(FocusedWnd: HWND); begin inherited DoKillFocus(FocusedWnd); FFocused := False; ! PopupCloseUp(FPopup, False); end; --- 2298,2317 ---- procedure TJvCustomComboEdit.DoKillFocus(FocusedWnd: HWND); + var + Sender: TWinControl; begin inherited DoKillFocus(FocusedWnd); FFocused := False; ! ! Sender := FindControl(FocusedWnd); ! if (Sender <> Self) and (Sender <> FPopup) and ! {(Sender <> FButton)} ((FPopup <> nil) and ! not FPopup.ContainsControl(Sender)) then ! begin ! { MSDN : While processing this message (WM_KILLFOCUS), do not make any ! function calls that display or activate a window. ! } ! AsyncPopupCloseUp(False); ! end; end; *************** *** 2384,2387 **** --- 2464,2472 ---- end; + function TJvCustomComboEdit.GetSettingCursor: Boolean; + begin + Result := TCustomMaskEditAccessPrivate(Self).FSettingCursor; + end; + function TJvCustomComboEdit.GetShowButton: Boolean; begin *************** *** 2496,2499 **** --- 2581,2585 ---- begin Key := #0; + { (rb) Next code has no use because Key = #0? } if (Form <> nil) {and Form.KeyPreview} then TWinControlAccessProtected(Form).KeyPress(Key); *************** *** 3334,3337 **** --- 3420,3440 ---- {$ENDIF VCL} + {$IFDEF VCL} + procedure TJvCustomComboEdit.WndProc(var Msg: TMessage); + begin + if not SettingCursor and PopupVisible and + (Msg.Msg >= WM_KEYFIRST) and (Msg.Msg <= WM_KEYLAST) and + (FPopup is TJvPopupWindow) and Assigned(TJvPopupWindow(FPopup).ActiveControl) then + begin + with Msg do + Result := TJvPopupWindow(FPopup).ActiveControl.Perform(Msg, WParam, LParam); + + if Msg.Result = 0 then Exit; + end; + + inherited WndProc(Msg) + end; + {$ENDIF VCL} + //=== { TJvCustomComboEditActionLink } ======================================= *************** *** 4333,4340 **** end; - procedure TJvFileDirEdit.ClearFileList; - begin - end; - procedure TJvFileDirEdit.Change; var --- 4436,4439 ---- *************** *** 4351,4354 **** --- 4450,4456 ---- end; + procedure TJvFileDirEdit.ClearFileList; + begin + end; {$IFDEF JVCLThemesEnabled} *************** *** 4850,4855 **** --- 4952,4962 ---- constructor TJvPopupWindow.Create(AOwner: TComponent); begin + {$IFDEF VisualClx} // (p3) have to use CreateNew for VCL as well since there is no dfm inherited CreateNew(AOwner); + {$ELSE} + inherited Create(AOwner); + {$ENDIF} + FEditor := TWinControl(AOwner); ControlStyle := ControlStyle + [csNoDesignVisible, csReplicatable, csAcceptsControls]; *************** *** 4860,4864 **** Parent := FEditor; // use same size on small and large font: ! Scaled := False; {$ENDIF VCL} end; --- 4967,4971 ---- Parent := FEditor; // use same size on small and large font: ! //Scaled := False; {$ENDIF VCL} end; *************** *** 4976,4982 **** {$IFDEF VCL} procedure TJvPopupWindow.WMMouseActivate(var Msg: TMessage); begin ! Msg.Result := MA_NOACTIVATE; end; {$ENDIF VCL} --- 5083,5101 ---- {$IFDEF VCL} + procedure TJvPopupWindow.WMActivate(var Msg: TWMActivate); + begin + if Msg.Active = WA_INACTIVE then + CloseUp(False); + inherited; + end; + {$ENDIF VCL} + + {$IFDEF VCL} procedure TJvPopupWindow.WMMouseActivate(var Msg: TMessage); begin ! if FIsFocusable then ! inherited ! else ! Msg.Result := MA_NOACTIVATE; end; {$ENDIF VCL} |