* * *

Author Topic: [Resolved - sort of] Toolbar TabStop setting not respected  (Read 443 times)

mtrsoft

  • New member
  • *
  • Posts: 14
[Resolved - sort of] Toolbar TabStop setting not respected
« on: November 11, 2018, 04:13:50 am »
The problem is that when "tabbing" on a form with a TToolbar and several other controls the Toolbar nor any of its buttons ever receive the focus.

I've tested this on Win7/32 with Lazarus 1.8.4 and 2.0RC2.

The issue can be seen by doing the following:

1. Create a new application.

2. Place a toolbar on the form and set its properties: ShowCaptions to True and TabStop to True.
2a. Right click on the toolbar and add two buttons on the toolbar.

3. Place two regular buttons on the form.

4. Run the application.

5. Press the Tab key multiple times. The buttons on the form will receive the focus, but neither the toolbar or any of its buttons will receive the focus.

6. Exit the program.

Am I missing something or ?

Regards,
John
« Last Edit: November 11, 2018, 08:33:22 pm by mtrsoft »

Blaazen

  • Hero Member
  • *****
  • Posts: 2659
  • POKE 54296,15
    • Eye-Candy Controls
Re: Toolbar TabStop setting not respected
« Reply #1 on: November 11, 2018, 05:11:10 am »
Buttons on TToolBar are TGraphicControl descendants, they cannot have focus (they don't even have TabStop and TabOrder properties).
Lazarus 2.1.0 r59474M FPC 3.3.1 r40247 x86_64-linux-qt Chakra, Qt 4.8.7/5.11.2, Plasma 5.14.2
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.14

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

mtrsoft

  • New member
  • *
  • Posts: 14
Re: Toolbar TabStop setting not respected
« Reply #2 on: November 11, 2018, 05:32:57 am »
Blaazen,

I realize that, BUT I would expect the toolbar to receive the focus so that one could then use the arrow key to cycle over the toolbar buttons.

I suppose the "real" question should have been "How can I access the toolbar buttons using the keyboard rather than the mouse?"

howardpc

  • Hero Member
  • *****
  • Posts: 2808
Re: Toolbar TabStop setting not respected
« Reply #3 on: November 11, 2018, 10:25:47 am »
Quote
I suppose the "real" question should have been "How can I access the toolbar buttons using the keyboard rather than the mouse?"
By building your own non-standard toolbar that uses toolbuttons which descend from TWinControl.

taazz

  • Hero Member
  • *****
  • Posts: 5344
Re: Toolbar TabStop setting not respected
« Reply #4 on: November 11, 2018, 10:33:32 am »
Blaazen,

I realize that, BUT I would expect the toolbar to receive the focus so that one could then use the arrow key to cycle over the toolbar buttons.

I suppose the "real" question should have been "How can I access the toolbar buttons using the keyboard rather than the mouse?"
1) I always use action lists and attach an action to each tool button that way the action shortcut can be used directly.
2) are the caption of the toolbar visible? if yes then isn't the hot key working on toolbars? truly asking, I haven't tested or used that feature.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

jamie

  • Hero Member
  • *****
  • Posts: 920
Re: Toolbar TabStop setting not respected
« Reply #5 on: November 11, 2018, 05:04:56 pm »
I just tested this on my Delphi installation (old one d3) and it works there... The TAB system does go to the Toolbar
but not with Lazarus...
  The Toolbar is a TWincontrol and of course it does have the TABStop property etc, which does not work apparently...

 I used the OnEnter as the test which gets triggered when control receives focus.., works fine with my Delphi 3.

 Most likely will work with my D7 if I had it handy...

 I think this should be reported.

P.S.

  Looks like it has been disabled by design.. !?
 
  The closes class is simply returning FALSE on CanFocus, basically not allowing the TWinControl to focus.
« Last Edit: November 11, 2018, 06:01:28 pm by jamie »

ASerge

  • Hero Member
  • *****
  • Posts: 967
Re: Toolbar TabStop setting not respected
« Reply #6 on: November 11, 2018, 06:27:39 pm »
I just tested this on my Delphi installation (old one d3) and it works there... The TAB system does go to the Toolbar
but not with Lazarus...
I think this should be reported.
Despite the fact that Delphi allows it, it is useless, because neither arrow navigation, nor pressing buttons from the keyboard is impossible.

jamie

  • Hero Member
  • *****
  • Posts: 920
Re: Toolbar TabStop setting not respected
« Reply #7 on: November 11, 2018, 06:47:23 pm »
Ok, so the OnEnter, OnExit, TabStop  and things related are useless?

I can implement the keyboard events at runtime, and change the image indexes of the buttons to reflect position..

I have done this with Delphi apps but it would nice for the control to trigger its OnEnter and OnExit, otherwise why have the
Tabstop properites related events ?


P.s.
 It appears the TtoolButton has an OnPaint event published, something my old D3 didn't have so I don't know when this
came about?, but this also means one can draw their buttons to reflect indication etc, like a dotted box and so on..
  I suppose one could parent the Toobar with a TPanel to get the effects needed...

 I meant to say the TtoolBar as the event.

« Last Edit: November 11, 2018, 07:17:12 pm by jamie »

ASerge

  • Hero Member
  • *****
  • Posts: 967
Re: Toolbar TabStop setting not respected
« Reply #8 on: November 11, 2018, 07:18:09 pm »
Ok, so the OnEnter, OnExit, TabStop  and things related are useless?
Toolbar (historically) was added in addition to application's menu: direct way for the user to access an application's commands by mouse. That is, the use of the keyboard is not expected. But of course, everything can be realized.

mtrsoft

  • New member
  • *
  • Posts: 14
Re: Toolbar TabStop setting not respected
« Reply #9 on: November 11, 2018, 08:29:18 pm »
Thanks to all for you comments.

It seems that I will be able to accomplish most of I want by using a FlowPanel with with Buttons, BitButtons or SpeedButtons.

The only issue with this approach is that the various button types do not take an image list that can be used to indicate the button state; i.e., normal, disabled, hot and pressed.

Once again, thank you all.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus