Commit Graph

6822 Commits

Author SHA1 Message Date
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
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
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
rich2014
3eccd94680 LCL/TCustomComboBox: refactor in TCustomComboBox.MatchListItem() 2023-06-16 21:58:16 +08:00
Juha
87fe030800 LazControls, LCL: Add shortcuts to TreeFilterEdit to work with TreeView. Issue #40321, patch by n7800. 2023-06-16 02:01:21 +03:00
rich2014
055ae4d900 LCL/TCustomComboBox: fix CaseSensitive in MatchListItem() 2023-06-16 00:01:16 +08:00
Juha
74446557f6 Remove old deprecated functions and units. 2023-06-15 02:35:52 +03:00
rich2014
6d9db64d24 LCL/TCustomComboBox: CaseSensitive supported in RealSetText() 2023-06-14 23:43:42 +08:00
rich2014
062bacda7a LCL/TCustomComboBox: Sorted supported (Cocoa first) 2023-06-14 22:39:47 +08:00
Juha
ab21cfa331 LCL: Add BeginUpdate..EndUpdate for FullCollapse and FullExpand in TreeView. Issue #40304, patch by n7800. 2023-06-08 18:39:21 +03:00
Juha
f3afdc8d50 LCL: Add a wrapper for Types.OffsetRect() into LCLIntf. 2023-06-07 00:45:54 +03:00
Juha
1475336c8c Remove LCLProc.OffsetRect(). Move some functions from LCLProc to GraphMath (LazUtils). 2023-06-05 15:48:01 +03:00
mattias
e89e0d7dcd lcl: ShowModal: handleexception of Idle, otherwise error dialog is auto closed 2023-06-01 10:57:23 +02:00
Bart
d405afa039 LCL: in TRadioGroup and TCheckGroup don't set the name for runtime created radiobuttons/checkboxes.
They are not needed and can give rise to unexpected crashes if the name already exists.
2023-05-20 14:50:19 +02:00
Bart
5137735655 LCL: fix crash when using freeing a component of a TRadioGroup or TCheckGroup. Issue #40261. 2023-05-20 14:42:36 +02:00
Juha
21ea45d415 Support compiling some Lazarus code with -Sy option. Issue #40263, patch by Arioch The. 2023-05-20 12:51:35 +03:00
wp_xyz
f793569190 LCL: Fix high-dpi scaling of the TabHeight and TabWidth properties of TPageControl and TTabControl 2023-05-16 22:28:12 +02:00
Juha
f99bd70b72 Improve scaling of DateTimePicker. Leave GetDetailSize in places which are not fully tested yet. 2023-04-29 19:44:23 +03:00
wp_xyz
77ae9452b9 Misc: Switch x and y loops at several places. Issue #40231 2023-04-29 16:38:00 +02:00
Juha
c14934764c LCL: Call TThemeServices.GetDetailSizeForPPI with proper arguments. Revert 1138d26280. 2023-04-27 17:23:33 +03:00