浏览代码

Sizeable Generate URL/Code dialog

Source commit: 492ae34eb6c446cef0f71edba3066c47a38aee0a
Martin Prikryl 10 年之前
父节点
当前提交
e03af11254
共有 2 个文件被更改,包括 34 次插入0 次删除
  1. 31 0
      source/forms/GenerateUrl.cpp
  2. 3 0
      source/forms/GenerateUrl.h

+ 31 - 0
source/forms/GenerateUrl.cpp

@@ -320,3 +320,34 @@ void __fastcall TGenerateUrlDialog::HelpButtonClick(TObject * /*Sender*/)
   FormHelp(this);
 }
 //---------------------------------------------------------------------------
+void __fastcall TGenerateUrlDialog::WMNCCreate(TWMNCCreate & Message)
+{
+  // bypass TForm::WMNCCreate to prevent disabling "resize"
+  // (which is done for bsDialog, see comments in CreateParams)
+  DefaultHandler(&Message);
+}
+//---------------------------------------------------------------------------
+void __fastcall TGenerateUrlDialog::Dispatch(void * AMessage)
+{
+  TMessage & Message = *reinterpret_cast<TMessage *>(AMessage);
+  if (Message.Msg == WM_NCCREATE)
+  {
+    WMNCCreate(*reinterpret_cast<TWMNCCreate *>(AMessage));
+  }
+  else
+  {
+    TForm::Dispatch(AMessage);
+  }
+}
+//---------------------------------------------------------------------------
+void __fastcall TGenerateUrlDialog::CreateParams(TCreateParams & Params)
+{
+  TForm::CreateParams(Params);
+
+  // Allow resizing of the window, even if this is bsDialog.
+  // This makes it more close to bsSizeable, but bsSizeable cannot for some
+  // reason receive focus, if window is shown atop non-main window
+  // (like editor)
+  Params.Style = Params.Style | WS_THICKFRAME;
+}
+//---------------------------------------------------------------------------

+ 3 - 0
source/forms/GenerateUrl.h

@@ -35,6 +35,7 @@ __published:
   void __fastcall ControlChange(TObject *Sender);
   void __fastcall ClipboardButtonClick(TObject *Sender);
   void __fastcall HelpButtonClick(TObject *Sender);
+  void __fastcall WMNCCreate(TWMNCCreate & Message);
 
 private:
   TSessionData * FData;
@@ -45,6 +46,8 @@ protected:
   void __fastcall UpdateControls();
   UnicodeString __fastcall GenerateUrl(UnicodeString Path);
   bool __fastcall IsFileUrl();
+  virtual void __fastcall CreateParams(TCreateParams & Params);
+  virtual void __fastcall Dispatch(void * AMessage);
 
 public:
   __fastcall TGenerateUrlDialog(TComponent * Owner, TSessionData * Data, TStrings * Paths);