Recent

Author Topic: Declare Variable IDE tool default button  (Read 6460 times)

DimTim

  • New Member
  • *
  • Posts: 42
Declare Variable IDE tool default button
« on: July 28, 2023, 09:13:50 am »
...now it is the HELP button, which is inconvenient: you have to press TAB, and then ENTER.  It would be logical to make OK the default button.  For myself, I just removed the HELP button, but maybe others also feel that inconvenient.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Re: Declare Variable IDE tool default button
« Reply #1 on: July 28, 2023, 01:54:38 pm »
It is unit DeclareVarDlg in components/codetools/ide/.
There ButtonPanel1.DefaultButton = pbOK and in design time the OK button is shown as default.
DefaultButton is not changes in run time.
I don't understand why the Help button becomes default. Could you please debug the code.
ButtonPanel is used in many places. I don't believe it has such a bug.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

DimTim

  • New Member
  • *
  • Posts: 42
Re: Declare Variable IDE tool default button
« Reply #2 on: July 28, 2023, 04:55:28 pm »
Even on the help page, which is displayed when that button is pressed, HELP shown as default: https://wiki.lazarus.freepascal.org/Cody#Declare_Variable :)

For myself, I just edited declarevardlg.lfm, line 23:
Code: [Select]
ShowButtons = [pbOK, pbCancel, pbHelp]to
Code: [Select]
ShowButtons = [pbOK, pbCancel]

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Re: Declare Variable IDE tool default button
« Reply #3 on: July 28, 2023, 10:21:37 pm »
Even on the help page, which is displayed when that button is pressed, HELP shown as default: https://wiki.lazarus.freepascal.org/Cody#Declare_Variable :)
Yes because that is a screenshot and a bug is included in the screenshot obviously. Why would a bug go away when somebody takes a screenshot of it?

Quote
For myself, I just edited declarevardlg.lfm, line 23:
Code: [Select]
ShowButtons = [pbOK, pbCancel, pbHelp]to
Code: [Select]
ShowButtons = [pbOK, pbCancel]
OK, you removed the Help button. It can be done easier than by editing declarevardlg.lfm. Does not solve the actual issue.

Can somebody please try to reproduce the bug with a simple example project with a form and a ButtonPanel.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

dsiders

  • Hero Member
  • *****
  • Posts: 1282
Re: Declare Variable IDE tool default button
« Reply #4 on: July 29, 2023, 03:45:27 am »
Even on the help page, which is displayed when that button is pressed, HELP shown as default: https://wiki.lazarus.freepascal.org/Cody#Declare_Variable :)
Yes because that is a screenshot and a bug is included in the screenshot obviously. Why would a bug go away when somebody takes a screenshot of it?

Quote
For myself, I just edited declarevardlg.lfm, line 23:
Code: [Select]
ShowButtons = [pbOK, pbCancel, pbHelp]to
Code: [Select]
ShowButtons = [pbOK, pbCancel]
OK, you removed the Help button. It can be done easier than by editing declarevardlg.lfm. Does not solve the actual issue.

Can somebody please try to reproduce the bug with a simple example project with a form and a ButtonPanel.

His complaint is that the Help button is always the first one in the tab order for keyboard navigation. See the UpdateButtonOrder method for the panel.
Preview the next Lazarus documentation release at: https://dsiders.gitlab.io/lazdocsnext

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Re: Declare Variable IDE tool default button
« Reply #5 on: July 29, 2023, 06:21:32 am »
His complaint is that the Help button is always the first one in the tab order for keyboard navigation.
Yes I know. To fix it he removed the Help button from ShowButtons set. It is OK but I am interested in the actual reason for this bug. That's why I asked if somebody could reproduce it with a simple example project. I will do it later myself if nobody else does.

Quote
See the UpdateButtonOrder method for the panel.
That deals with ButtonOrder which can also be set in OI. It does not affect the default button. There is DefaultButton property for that. In DeclareVarDlg it is pbOK, thus the OK button should be default.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

n7800

  • Full Member
  • ***
  • Posts: 175
Re: Declare Variable IDE tool default button
« Reply #6 on: April 13, 2024, 04:54:04 am »
The "default" button is the button that will be automatically pressed when [Enter] is pressed. Of course, if at this moment the focus is not on the component, which itself reacts to [Enter]. And since the tab order in this dialog starts from the TButtonPanel, the Help button is selected first (from left to right, as needed).

I fixed the tab order and set ActiveControl to TEdit. The default focus is now on the type input field, and pressing [Enter] activates the default button OK.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Re: Declare Variable IDE tool default button
« Reply #7 on: April 14, 2024, 10:58:05 pm »
I finally noticed the patch and applied it. Thanks.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018