Re: [Lazarus] Is TForm.LastActiveControl working correctly?

2020-12-06 Thread Juha Manninen via lazarus
On Sun, Dec 6, 2020 at 1:22 PM frans via lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> ActiveControl and lastActiveControl always point to the same control.
>

> Is this a bug or is my understanding of lastActiveControl wrong?
>

That is how it is implemented. It is set to ActiveControl
unless ActiveControl is Nil or a TCustomForm.
  if (FActiveControl<>nil) and not (FActiveControl is TCustomForm) then
FLastActiveControl := FActiveControl;

I did not know about LastActiveControl. What is the use of it? TScreen
class seems to have it, too.
Anyway, you can easily keep track of the previous ActiveControl in your
code yourself.

Regards,
Juha
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Is TForm.LastActiveControl working correctly?

2020-12-06 Thread frans via lazarus

Hi,

I'm using Lazarus 2.0.10 on Windows10 and I'm trying to make use of 
TForm.LastActiveControl.
My form has a TButtonpanel with HelpButton and CancelButton visible. 
There is an Actionlist with 2 actions, each with a Shortcut (F1 and 
Esc). The form has 3 TLabeledEdit fields.
My purpose is that the field that has the focus keeps that (I do that in 
the FormOnActivate routine) after calling Help by clicking on the 
HelpButton.  But that is not the case, the focus is placed on that 
HelpButton.
I added some debug lines to check the value of ActiveControl and 
LastActiveControl in an OnEnter and OnExit routine for each field. The 
result is that every action I take (use tab of mouse to activate another 
control) gives the same result: ActiveControl and lastActiveControl 
allways point to the same control.


Is this a bug or is my understanding of lastActiveControl wrong?

--
mvg
Frans van Leeuwen
M 06-51695390


--
Deze e-mail is gecontroleerd op virussen door AVG.
http://www.avg.com

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus