⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jvqexcomboedits.pas

📁 East make Tray Icon in delphi
💻 PAS
📖 第 1 页 / 共 4 页
字号:
begin
  with Mesg do
  begin
    Handled := inherited HintShow(HintInfo^);
  end;
end;

procedure TJvExCustomComboMaskEdit.CMSysFontChanged(var Mesg: TMessage);
begin
  if FDesktopFont then
  begin
    Font.Assign(Application.Font);
    FDesktopFont := True;
  end;
end;

procedure TJvExCustomComboMaskEdit.EnabledChanged;
begin
  Perform(CM_ENABLEDCHANGED, 0, 0);
  inherited EnabledChanged;
end;

procedure TJvExCustomComboMaskEdit.TextChanged;
begin
  Perform(CM_TEXTCHANGED, 0, 0);
  inherited TextChanged;
end;

procedure TJvExCustomComboMaskEdit.VisibleChanged;
begin
  Perform(CM_VISIBLECHANGED, 0, 0);
  inherited VisibleChanged;
end;

function TJvExCustomComboMaskEdit.HintShow(var HintInfo : THintInfo): Boolean;
begin
  Result := Perform(CM_HINTSHOW, 0, Integer(@HintInfo)) <> 0;
end;

procedure TJvExCustomComboMaskEdit.MouseEnter(AControl: TControl);
begin
  Perform(CM_MOUSEENTER, 0, 0);
  inherited MouseEnter(AControl);
end;

procedure TJvExCustomComboMaskEdit.MouseLeave(AControl: TControl);
begin
  Perform(CM_MOUSELEAVE, 0, 0);
  inherited MouseLeave(AControl);
end;

procedure TJvExCustomComboMaskEdit.ParentColorChanged;
begin
  inherited ParentColorChanged;
  if Assigned(FOnParentColorChanged) then
    FOnParentColorChanged(Self);
end;

procedure TJvExCustomComboMaskEdit.SetDesktopFont(Value: Boolean);
begin
  if FDesktopFont <> Value then
  begin
    FDesktopFont := Value;
    Perform(CM_SYSFONTCHANGED, 0, 0);
  end;
end;

procedure TJvExCustomComboMaskEdit.Dispatch(var Mesg);
begin
  if Assigned(FWindowProc) then
    FWindowProc(TMessage(Mesg))
  else
    inherited Dispatch(Mesg);
end;

function TJvExCustomComboMaskEdit.Perform(Msg: Cardinal; WParam, LParam: Longint): Longint;
var
  Mesg: TMessage;
begin
  Mesg.Msg := Msg;
  Mesg.WParam := WParam;
  Mesg.LParam := LParam;
  Mesg.Result := 0;
  Dispatch(Mesg);
  Result := Mesg.Result;
end;

function TJvExCustomComboMaskEdit.IsRightToLeft: Boolean;
begin
  Result := False;
end;
  

procedure TJvExComboMaskEdit.DoBeepOnError;
begin
  if BeepOnError then
    SysUtils.Beep;
end;

procedure TJvExComboMaskEdit.SetBeepOnError(Value: Boolean);
begin
  FBeepOnError := Value;
end;

{ QEditControl Create }

constructor TJvExComboMaskEdit.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FInternalFontChanged := Font.OnChange;
  Font.OnChange := DoOnFontChanged;
  FHintColor := clDefault;
  FClipBoardCommands := [caUndo, caCopy, caPaste, caCut];
  FCanvas := TQtCanvas.Create;
  TQtCanvas(FCanvas).QtHandle := Handle;
  FBeepOnError := True;
end;

destructor TJvExComboMaskEdit.Destroy;
begin
  
  FCanvas.Free;
  inherited Destroy;
end;
 
procedure TJvExComboMaskEdit.WMClear(var Mesg: TMessage);
begin
  inherited Clear;
end;

procedure TJvExComboMaskEdit.WMCopy(var Mesg: TMessage);
begin
  inherited CopyToClipBoard;
end;

procedure TJvExComboMaskEdit.WMCut(var Mesg: TMessage);
begin
  inherited CutToClipBoard;
end;

procedure TJvExComboMaskEdit.WMPaste(var Mesg: TMessage);
begin
  inherited PasteFromClipBoard;
end;

procedure TJvExComboMaskEdit.WMUndo(var Mesg: TMessage);
begin
  inherited Undo;
end;
 
{ QEditControl Common}

procedure TJvExComboMaskEdit.WndProc(var Mesg: TMessage);
begin
  with TJvMessage(Mesg) do
  begin
    case Msg of
      WM_GETTEXTLENGTH : Result := Length(GetText);

      WM_CLEAR, WM_COPY,
      WM_CUT, WM_PASTE, WM_UNDO :
        if DoClipBoardCommands(msg, FClipBoardCommands) then
          inherited Dispatch(msg);

      EM_UNDO:  Result := Perform(WM_UNDO, 0, 0);
      { WinControl Messages }
      WM_KILLFOCUS   : DoKillFocus(FocusedWnd);
      WM_SETFOCUS    : DoSetFocus(FocusedWnd);
      CM_FONTCHANGED : FInternalFontChanged(Font);
      CM_HINTSHOW    : HintInfo^.HintColor := GetHintcolor(Self);
      WM_GETDLGCODE:
      begin
        Result := InputKeysToDlgCodes(InputKeys);
        Exit;
      end;
      WM_ERASEBKGND:
      begin
        Canvas.Start;
        try
          Handled := DoPaintBackGround(Canvas, LParam);
        finally
          Canvas.Stop;
        end;
        Exit;
      end;
      { Control Messages }
      CM_FOCUSCHANGED: FocusChanged;
      CM_MOUSEENTER: FMouseOver := True;
      CM_MOUSELEAVE: FMouseOver := False;
    else
      inherited Dispatch(Mesg);
    end;
  end;
end;

procedure TJvExComboMaskEdit.Undo;
begin
  SendMessage(Handle, WM_UNDO, 0, 0);
end;

procedure TJvExComboMaskEdit.CopyToClipboard;
begin
  SendMessage(Handle, WM_COPY, 0, 0);
end;

procedure TJvExComboMaskEdit.CutToClipboard;
begin
  if not ReadOnly then
    SendMessage(Handle, WM_CUT, 0, 0);
end;

procedure TJvExComboMaskEdit.Clear;
begin
  if not ReadOnly then
    SendMessage(Handle, WM_CLEAR, 0, 0);
end;

procedure TJvExComboMaskEdit.PasteFromClipboard;
begin
  if not ReadOnly then
    SendMessage(Handle, WM_PASTE, 0, 0);
end;
 
{ WinControl Paint }


procedure TJvExComboMaskEdit.Paint;
begin
  TControlCanvas(Canvas).StopPaint;
  inherited Painting(Handle, QPainter_clipRegion(Canvas.Handle));
  TControlCanvas(Canvas).StartPaint;
end;

procedure TJvExComboMaskEdit.Painting(Sender: QObjectH; EventRegion: QRegionH);
begin
  if QRegion_isEmpty(EventRegion) then
    Exit;
//  QPainter_setClipping(Canvas.Handle, True);
  TControlCanvas(Canvas).StartPaint;
  try
    QPainter_setClipRegion(Canvas.Handle, EventRegion);
    Canvas.Brush.Assign(Brush);
    Canvas.Font.Assign(Font);
    RequiredState(Canvas, [csHandleValid, csFontValid, csBrushValid]);
    Paint;
  finally
    TControlCanvas(Canvas).StopPaint;
  end;
end;
 
{ QWinControl Common }
procedure TJvExComboMaskEdit.CMDesignHitTest(var Mesg: TJvMessage);
begin
  with Mesg do
  begin
    Handled := inherited HitTest(XPos, YPos);
    if Handled then
      Result := HTCLIENT;
  end;
end;

procedure TJvExComboMaskEdit.CMHitTest(var Mesg: TJvMessage);
begin
  with Mesg do
  begin
    if csDesigning in ComponentState then
      Result := Perform(CM_DESIGNHITTEST, XPos, YPos)
    else
    begin
      Handled := inherited HitTest(XPos, YPos);
      if Handled then
        Result := HTCLIENT;
    end;
  end;
end;

function TJvExComboMaskEdit.DoPaintBackground(Canvas: TCanvas; Param: Integer): Boolean;
begin
  Result := false;
end;

procedure TJvExComboMaskEdit.ShowingChanged;
begin
  Perform(CM_SHOWINGCHANGED, 0 ,0);
  inherited;
end;

procedure TJvExComboMaskEdit.ColorChanged;
begin
  Perform(CM_COLORCHANGED, 0, 0);
  inherited;
end;

procedure TJvExComboMaskEdit.CursorChanged;
begin
  Perform(CM_CURSORCHANGED, 0, 0);
  inherited;
end;

procedure TJvExComboMaskEdit.DoSetFocus(PreviousWnd: QWidgetH);
begin
  { notification }
end;

procedure TJvExComboMaskEdit.DoKillFocus(NextWnd: QWidgetH);
begin
  { notification }
end;

procedure TJvExComboMaskEdit.DoEnter;
begin
  Perform(CM_ENTER, 0 ,0);
  inherited DoEnter;
end;

procedure TJvExComboMaskEdit.DoExit;
begin
  Perform(CM_EXIT, 0 ,0);
  inherited DoExit;
end;

function TJvExComboMaskEdit.EventFilter(Sender: QObjectH; Event: QEventH): Boolean;
begin
  Result := False;
  if Assigned(FOnEvent) then
    FOnEvent(Sender, Event, Result);
  if not Result then
    Result := inherited EventFilter(Sender, Event); 
end;

procedure TJvExComboMaskEdit.FocusChanged;
begin
  NotifyControls(CM_FOCUSCHANGED);
end;

procedure TJvExComboMaskEdit.DoOnFontChanged(Sender: TObject);
begin
  ParentFont := False;
  PostMessage(Self, CM_FONTCHANGED, 0, 0);
end;

procedure TJvExComboMaskEdit.CreateWidget;
begin
  CreateWnd;
end;

procedure TJvExComboMaskEdit.CreateWnd;
begin
  inherited CreateWidget;
end;

procedure TJvExComboMaskEdit.RecreateWnd;
begin
  if not (csRecreating in ControlState) then
    RecreateWidget;
end;

procedure TJvExComboMaskEdit.PaintTo(PaintDevice: QPaintDeviceH; X, Y: Integer);
begin
  WidgetControl_PaintTo(self, PaintDevice, X, Y);
end;

procedure TJvExComboMaskEdit.PaintWindow(PaintDevice: QPaintDeviceH);
begin
  PaintTo(PaintDevice, 0, 0);
end;

function TJvExComboMaskEdit.WidgetFlags: Integer;
begin
  Result := inherited WidgetFlags or
    Integer(WidgetFlags_WRepaintNoErase) or
    Integer(WidgetFlags_WMouseNoMask);
end;

function TJvExComboMaskEdit.ColorToRGB(Value: TColor): TColor;
begin
  Result := QWindows.ColorToRGB(Value, self);
end;
  
{ QControl Common}

function TJvExComboMaskEdit.HitTest(X, Y: integer): Boolean;
begin
   Result := Perform(CM_HITTEST, 0, 0) <> HTNOWHERE;
end;

procedure TJvExComboMaskEdit.CMHintShow(var Mesg: TJvMessage);
begin
  with Mesg do
  begin
    Handled := inherited HintShow(HintInfo^);
  end;
end;

procedure TJvExComboMaskEdit.CMSysFontChanged(var Mesg: TMessage);
begin
  if FDesktopFont then
  begin
    Font.Assign(Application.Font);
    FDesktopFont := True;
  end;
end;

procedure TJvExComboMaskEdit.EnabledChanged;
begin
  Perform(CM_ENABLEDCHANGED, 0, 0);
  inherited EnabledChanged;
end;

procedure TJvExComboMaskEdit.TextChanged;
begin
  Perform(CM_TEXTCHANGED, 0, 0);
  inherited TextChanged;
end;

procedure TJvExComboMaskEdit.VisibleChanged;
begin
  Perform(CM_VISIBLECHANGED, 0, 0);
  inherited VisibleChanged;
end;

function TJvExComboMaskEdit.HintShow(var HintInfo : THintInfo): Boolean;
begin
  Result := Perform(CM_HINTSHOW, 0, Integer(@HintInfo)) <> 0;
end;

procedure TJvExComboMaskEdit.MouseEnter(AControl: TControl);
begin
  Perform(CM_MOUSEENTER, 0, 0);
  inherited MouseEnter(AControl);
end;

procedure TJvExComboMaskEdit.MouseLeave(AControl: TControl);
begin
  Perform(CM_MOUSELEAVE, 0, 0);
  inherited MouseLeave(AControl);
end;

procedure TJvExComboMaskEdit.ParentColorChanged;
begin
  inherited ParentColorChanged;
  if Assigned(FOnParentColorChanged) then
    FOnParentColorChanged(Self);
end;

procedure TJvExComboMaskEdit.SetDesktopFont(Value: Boolean);
begin
  if FDesktopFont <> Value then
  begin
    FDesktopFont := Value;
    Perform(CM_SYSFONTCHANGED, 0, 0);
  end;
end;

procedure TJvExComboMaskEdit.Dispatch(var Mesg);
begin
  if Assigned(FWindowProc) then
    FWindowProc(TMessage(Mesg))
  else
    inherited Dispatch(Mesg);
end;

function TJvExComboMaskEdit.Perform(Msg: Cardinal; WParam, LParam: Longint): Longint;
var
  Mesg: TMessage;
begin
  Mesg.Msg := Msg;
  Mesg.WParam := WParam;
  Mesg.LParam := LParam;
  Mesg.Result := 0;
  Dispatch(Mesg);
  Result := Mesg.Result;
end;

function TJvExComboMaskEdit.IsRightToLeft: Boolean;
begin
  Result := False;
end;
  

{$UNDEF CREATE_CUSTOMCODE} // undefine at file end

{$IFDEF UNITVERSIONING}
const
  UnitVersioning: TUnitVersionInfo = (
    RCSfile: '$RCSfile: JvQExComboEdits.pas,v $';
    Revision: '$Revision: 1.24 $';
    Date: '$Date: 2005/02/06 14:06:08 $';
    LogPath: 'JVCL\qrun'
  );

initialization
  RegisterUnitVersion(HInstance, UnitVersioning);

finalization
  UnregisterUnitVersion(HInstance);
{$ENDIF UNITVERSIONING}

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -