Commit Graph

6839 Commits

Author SHA1 Message Date
Juha
13d54fc4cb LCL: Refactor Colorbox code. Issue #40376, patch by n7800. 2023-08-01 11:55:14 +03:00
mattias
d4693029bc lcl: fixed compile 2023-07-31 13:52:38 +02:00
Bart
c3823da117 LCL: first try at implementing TApplication.ActiveFormHandle property.
Needs black-box testing against Delphi, especially when either no active form exists yet, or
when the active form's Active property is False (e.g. minimized, hidden of a non-LCL form is shwoing modally).
Also needs to be debated wether the return value should be TLCLHandle.
2023-07-31 13:10:57 +02:00
rich2014
53cd3db19c LCL: Fix #40416: Mouse Message issue (Enter/Level/Move) 2023-07-30 21:55:11 +08:00
Bart
bff41e1f5d TTaskDialog: In Execute, use the Handle of the current active form for the ParentWnd parameter.
Based upon the documentation of Delphi: https://docwiki.embarcadero.com/Libraries/Alexandria/en/Vcl.Dialogs.TCustomTaskDialog.Execute
It makes Execute honour the tfRelativeToWindow flag.
2023-07-29 23:29:53 +02:00
wp_xyz
11b92b26c8 LCL/SpeedButton: Fix position of caption when no glyph is present. 2023-07-29 00:36:46 +02:00
wp_xyz
07da832b28 LCL/SpeedButton: Fix positioning of Glyph and Caption. Issue #40410. Based on patch by Luca Olivetti. 2023-07-28 19:40:50 +02:00
Bart
f48fe7983e TTaskDialog: add a comment why Execute always returns True. 2023-07-28 17:20:27 +02:00
Bart
033512d064 Revert "TTaskDialog: fix Result value of Execute method:"
Apparently the Delhi docs arw wrong (as in: Delphi does not do what the dosc say: it awill always return True, as long as the dialog was shown.
2023-07-28 17:13:41 +02:00
Bart
cbd7579c15 TTaskDialog: fix Result value of Execute method:
- previously it returned True if the dialog succeeded to show, even if the dialog was cancelled.
- now it is False if the dialog is canceled.
- See https://docwiki.embarcadero.com/Libraries/Alexandria/en/Vcl.Dialogs.TCustomTaskDialog.Execute
2023-07-28 16:31:35 +02:00
Bart
e259355d76 TTaskDialog: initial support for query capability (combobox or single line edit).
The implementation differs from the one in (now deprecated) LCLTaskDialog:
- the type of query is controlled by flags only (which are mutually exclusive)
- for single line edit, you can set passwordchar
- intial value of single line query has no influence on combobox
- initial value of combobox is controlled by integer value, not by text
2023-07-27 00:05:09 +02:00
Bart
2722337e33 TTaskDialog: layout the initial infrastructure to add Query capability to TTaskDialog. 2023-07-26 16:13:50 +02:00
Juha
cc4760393b Reserve "On..." prefix for events and name functions differently. 2023-07-25 11:07:57 +03:00
Bart
158f10e193 LCL: Dialogs unit: cleanup. 2023-07-24 22:27:09 +02:00
Bart
71f8725fb8 Merge branch 'wstaskdialog' 2023-07-24 20:20:22 +02:00
Bart
cc10035843 Refactoring TTaskDialog:
- Win32 WS: fix not returning ButtonID.
- Win32 WS: initialize RadioRes return value.
2023-07-24 10:52:11 +02:00
Bart
b9634c255d Refactoring TTaskDialog: switch over to the new code, remove dependency on deprecated unit LCLTaskDialog. 2023-07-24 10:31:34 +02:00
Bart
92f83f8b59 Refactoring TTaskDialog:
- first attempt to get Win32 WS code working (currently littered with writeln() statements, so crashes if no console!)
- fix ModalResult in OnButtonClicked for emulated dialog.
2023-07-24 01:08:33 +02:00
Bart
4442949a29 Refactoring TTaskDialog: remove property ParentWindow (added in 61fefaa7), it's not longer needed. 2023-07-22 16:03:50 +02:00
Bart
85c1fff32d Refactoring TTaskDialog: move (and rename) constants for first radio/button index to Dialogs unit and use them there as well. 2023-07-22 15:55:17 +02:00
Bart
17fee115bf Refactoring TTaskDialog: TLCLTaskDialog: factor out AddFooter. 2023-07-22 10:48:11 +02:00
Juha
5a647cd4e1 DockedFormEditor: Solve the unrecoverable loop differently. Add a new handler for it. Issue #39288. 2023-07-20 23:46:25 +03:00
Bart
677a73c38c Refactoring TTaskDialog: fix compilation of Dialogs unit on non-windows platforms. 2023-07-20 20:17:40 +02:00
Bart
9a3e5c120d Refactoring TTaskDialog:
- Change signature of TWSTaskDialog.Execute and related functions/methods so we can set ParentWnd and retrieve RadioRes.
The TLCLTaskDialog now should act the same as the old emulated version (unit LCLTaskDialog).
2023-07-20 20:09:38 +02:00
Bart
1420ce0a69 Refactoring TTaskDialog:
- Use meaningfull names for private vars of TLCLTaskDialog
- Factor out SetupPanel
- Consistent capitalization of "Result" ,"True" and "False"
- Remove property VerifyChecked, set appropriate flag instead
- More debugln statements
- Add some comments
The emulated dialog is now more or less functional (we don't return RadioResult yet).
2023-07-20 19:54:20 +02:00
Juha
ca9cb1a6e4 Clean up procedure TScreen.EndTempCursor. Issue #40389. 2023-07-20 12:20:40 +03:00
Bart
c3c73c48fc Refactoring TTaskDialog:
- TWSTaskDialog.Execute: return integer (modal result of the dialog) instead of boolean
- Idem for related functions and methods
2023-07-20 10:55:48 +02:00
Bart
b163a35cb3 Refactoring TTaskDialog:
- Fix not displaying common buttons in TLCLTaskDialog.SetupControls
- Assign TLCLDialog.FDlg in the CreateNew() constructor.
- Free LDefaultFont
- Start comparing the new form vs the old form
Still not functional.
2023-07-19 19:43:35 +02:00
Bart
61fefaa794 Refactoring TTaskDialog:
- expose Dialogs.TTaskDialog.ParentWindow as reado only property (needed in TLCLTaskDialog.Execute)
- furhter implement adding controls at runtime to TLCLTaskDialog
- it compiles, but still not functional.
2023-07-19 12:07:21 +02:00
Bart
4d40d3f77a Refactoring TTaskDialog:
- Deprecated unit LCLTaskDialog.
- Unit TaskDlgEmulation: work in progress.
  - Start implementing TLCLTaskDialog class. Not functional yet (but at least it should compile).
  - Code copied and adapted from the now deprecated LCLTaskDialog unit.
- Temporarily exposed a private variable of Dialogs.TTaskDialog
2023-07-17 20:48:22 +02:00
Bart
32824af5fe TCustomTaskDialog: add a comment. 2023-07-17 14:01:35 +02:00
Bart
fc6bbcc936 TCustomTaskDialog: inherit form TLCLComponent and register the widgetset class. 2023-07-17 13:52:40 +02:00
Maxim Ganetsky
255bdd2bb0 Revert "LCL: Add an option to NOT call TCheckbox OnChange handler when clicked. Issue #39870, patch by Arioch The."
This reverts commit 9f577dc548.

Reasons:
1. The logic of VCL_OnClick_Emulation flag (or its name) is wrong: when it is true, OnChange event gets called LCL-style (note that VCL does not have OnChange event).
2. Having such flag is unsafe: e.g. some used unit can disable it and checkboxes in the whole program will _silently_ change their behavior.
3. The code claimed as a reason for introducing this change does not work in Delphi too.

Such Delphi compatibility issues should be handled another way.
2023-07-14 03:00:19 +03:00
Bart
e5aa4cee57 diff --git a/lcl/dialogs.pp b/lcl/dialogs.pp
index 24f69c5ac7..b156a70d9c 100644
--- a/lcl/dialogs.pp
+++ b/lcl/dialogs.pp
@@ -543,6 +543,7 @@ type
     tfShowMarqueeProgressBar, tfCallbackTimer,
     tfPositionRelativeToWindow, tfRtlLayout,
     tfNoDefaultRadioButton, tfCanBeMinimized,
+    tfNoSetForeGround, tfSizeToContent,
     tfForceNonNative, tfEmulateClassicStyle);
   TTaskDialogFlags = set of TTaskDialogFlag;

diff --git a/lcl/include/taskdialog.inc b/lcl/include/taskdialog.inc
index 2ce5a97571..ddf2f46aaa 100644
--- a/lcl/include/taskdialog.inc
+++ b/lcl/include/taskdialog.inc
@@ -179,6 +179,10 @@ function TCustomTaskDialog.DoExecute(ParentWnd: HWND): Boolean;
       Result := Result + [tdfNoDefaultRadioButton];
     if tfCanBeMinimized in aTaskFlags then
       Result := Result + [tdfCanBeMinimized];
+    if tfNoSetForeGround in aTaskFlags then
+      Result := Result + [tdfNoSetForeGround];
+    if tfSizeToContent in aTaskFlags then
+      Result := Result + [tdfSizeToContent];
   end;

   function TF_DIALOGICON(const aIcon: TTaskDialogIcon): LCLTaskDialog.TTaskDialogIcon;
diff --git a/lcl/lcltaskdialog.pas b/lcl/lcltaskdialog.pas
index 660702261f..2c3caccd43 100644
--- a/lcl/lcltaskdialog.pas
+++ b/lcl/lcltaskdialog.pas
@@ -127,7 +127,7 @@ interface

 uses
   {$IFDEF MSWINDOWS}
-  Windows, ctypes,
+  Windows, ctypes,  CommCtrl,
   {$ENDIF}
   Classes, SysUtils,
   LazUTF8,
@@ -172,7 +172,9 @@ type
     tdfExpandFooterArea, tdfExpandByDefault, tdfVerificationFlagChecked,
     tdfShowProgressBar, tdfShowMarqueeProgressBar, tdfCallbackTimer,
     tdfPositionRelativeToWindow, tdfRtlLayout, tdfNoDefaultRadioButton,
-    tdfCanBeMinimized, tdfQuery, tdfQueryMasked, tdfQueryFieldFocused);
+    tdfCanBeMinimized, tdfNoSetForeGround {added in Windows 8}, tdfSizeToContent,
+    //custom LCL flags
+    tdfQuery, tdfQueryMasked, tdfQueryFieldFocused);

   /// set of available configuration flags for the Task Dialog
   TTaskDialogFlags = set of TTaskDialogFlag;
@@ -771,6 +773,29 @@ var
     if ModalResult=aButtonDef then
       Dialog.Form.ActiveControl := result;
   end;
+  {$IFDEF MSWINDOwS}
+  function TaskDialogFlagsToInteger(aFlags: TTaskDialogFlags): Integer;
+  const
+    //missing from CommCtrls in fpc < 3.3.1
+    TDF_NO_SET_FOREGROUND = $10000;
+    TDF_SIZE_TO_CONTENT   = $1000000;
+    FlagValues: Array[TTaskDialogFlag] of Integer = (
+      TDF_ENABLE_HYPERLINKS, TDF_USE_HICON_MAIN, TDF_USE_HICON_FOOTER,
+      TDF_ALLOW_DIALOG_CANCELLATION, TDF_USE_COMMAND_LINKS, TDF_USE_COMMAND_LINKS_NO_ICON,
+      TDF_EXPAND_FOOTER_AREA, TDF_EXPANDED_BY_DEFAULT, TDF_VERIFICATION_FLAG_CHECKED,
+      TDF_SHOW_PROGRESS_BAR, TDF_SHOW_MARQUEE_PROGRESS_BAR, TDF_CALLBACK_TIMER,
+      TDF_POSITION_RELATIVE_TO_WINDOW, TDF_RTL_LAYOUT, TDF_NO_DEFAULT_RADIO_BUTTON,
+      TDF_CAN_BE_MINIMIZED, TDF_NO_SET_FOREGROUND {added in Windows 8}, TDF_SIZE_TO_CONTENT,
+      //custom LCL flags
+      0 {tdfQuery}, 0 {tdfQueryMasked}, 0 {tdfQueryFieldFocused});
+  var
+    aFlag: TTaskDialogFlag;
+  begin
+    Result := 0;
+    for aFlag := Low(TTaskDialogFlags) to High(TTaskDialogFlags) do
+      if (aFlag in aFlags) then Result := Result or FlagValues[aFlag];
+  end;
+  {$ENDIF MSWINWOS}

 var
   ARadioOffset: integer;
@@ -821,7 +846,7 @@ begin
       include(aFlags,tdfVerificationFlagChecked);
     if (Config.cButtons=0) and (aCommonButtons=[cbOk]) then
       Include(aFlags,tdfAllowDialogCancellation); // just OK -> Esc/Alt+F4 close
-    Config.dwFlags := integer(aFlags);
+    Config.dwFlags := TaskDialogFlagsToInteger(aFlags);
     Config.hMainIcon := TD_ICONS[aDialogIcon];
     Config.hFooterIcon := TD_FOOTERICONS[aFooterIcon];
     Config.nDefaultButton := aButtonDef;
2023-07-12 15:15:34 +02:00
mattias
c6200e29c8 lcl: TWinControl class completed 2023-07-12 11:35:47 +02:00
mattias
2dc7c77293 lcl: clean hostdocksite 2023-07-12 11:35:47 +02:00
Bart
a4c9080f10 TListBox: fix SelCount in case HandleAllocated = False. Issue #40361. 2023-07-07 22:42:25 +02:00
Juha
adfc424e92 Lazarus trunk requires at least FPC 3.2.0. Remove checks for earlier FPC_FULLVERSION. 2023-07-07 17:39:03 +03:00
Juha
41adb276bb Remove obsolete checks for FPC versions earlier then 3.0. 2023-07-07 17:39:02 +03:00
mattias
bcb890ce27 lcl: TScreen.UpdateLastActive: clear FLastActiveControl on destroy 2023-07-04 15:20:05 +02:00
Juha
0bc32656ed LazUtils, LCL: Move LCLProc.CompareRect() -> GraphMath.SameRect(). Deprecate LCLProc.CompareRect(). 2023-07-03 16:54:10 +03:00
Juha
211d95da17 LCL: Use TLCLHandle instead of a redefined LCLType.THandle or TLCLIntfHandle. Deprecate them. 2023-07-03 11:17:01 +03:00
Juha
c3891ad820 Reduce compiler warnings. 2023-07-03 06:23:49 +03:00
Abou Al Montacir
58645a39f4 GTK3: Fixed crash on Win64 after recent changes on GTK3 hints.
Seems that on Win64, `FHintControl` is not always a valid `TWinControl`
class instance.
2023-06-25 20:31:16 +02:00
Abou Al Montacir
f7c5d02afb GTK3: Fixed hint flickering when mouse moves.
Closes: #37712.

When mouse moves but remains over the same widget, we should not
recreate the hint window. Just break execution and 'exit `ActivateHint`
function early.
2023-06-25 15:59:22 +00:00
Abou Al Montacir
06ec2750ca GTK3: Passed handle of hint win control to WS inside hint data pointer.
Closes #40331.

GTK3 WS needs to get that handle in order to retrieve the parent window
which need to be set as transient of the newly created popup window.

This is a required by GTK3 documentation as one can see in
  https://docs.gtk.org/gtk3/method.Window.set_transient_for.html

This patch needs to touch common LCL code, but `HintData` files does
not seem to be really used.
2023-06-24 13:59:53 +00:00
rich2014
05555c84d5 Lcl/DrawText: Fix #40324: return value set to the height 2023-06-24 15:41:04 +08:00
Juha
cc7d9e60fb LCL: Simplify TTreeNode after adding support for Enabled property. Issue #40335, patch by n7800. 2023-06-20 11:09:58 +03:00
Maxim Ganetsky
79f7f1bbf2 LCL: Made TCustomImageList more extensible. Based on idea from merge request !202.
1. MarkAsChanged method (protected) is added, which sets FChanged to
true.
2. Virtual DoAfterUpdateStarted and DoBeforeUpdateEnded methods
(protected) are added. They are called in first BeginUpdate and last
EndUpdate respectively.
2023-06-19 16:11:00 +03:00
rich2014
280c57e91d LCL/TCustomComboBox: replace cbactEnabled with AutoComplete 2023-06-16 22:07:47 +08:00