ExplorerListGadget: two small additions

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Quin
Addict
Addict
Posts: 1133
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

ExplorerListGadget: two small additions

Post by Quin »

Hi,
I'm here with two small requests for ExplorerListGadget().
The first is that it should automatically put your keyboard focus on the first available file/folder every time it gets populated, even if it's just "..". This makes it so that when going into-out of a folder, screen reader users don't hear some random folder name announced, and actually have some sense of where their keyboard navigation is. If necessary, this one could definitely be a flag.
The second is to add an extra keyboard Shortcut, #PB_Shortcut_Backspace, for going up a level in the structure (if supported). We already have #PB_Shortcut_Return to go into a directory, may as well make it act like real Explorer and have backspace as well.
Thoughts?
Thanks!
BarryG
Addict
Addict
Posts: 4173
Joined: Thu Apr 18, 2019 8:17 am

Re: ExplorerListGadget: two small additions

Post by BarryG »

Quin wrote: Thu Dec 19, 2024 12:57 pmThe first is that it should automatically put your keyboard focus on the first available file/folder every time it gets populated
Oh no, I have to disagree with that. I populate the ExplorerListGadget (and ListIconGadgets) depending on what I'm typing in a StringGadget in realtime, so if the StringGadget loses focus with each keystroke it would be so annoying. For your situation, you can just set the focus yourself after populating. :)

[Edit] Or with a flag, as you said. ;) I'm just opposed to any gadgets getting the focus automatically. Should be up to the coder.
Quin
Addict
Addict
Posts: 1133
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: ExplorerListGadget: two small additions

Post by Quin »

Oh no, I should've been more clear. All I meant is that the first item in the list should be automatically selected when the gadget populates. Go onto an explorerListGadget and then press your up/down arrow keys, you'll notice that the first press of down arrow takes you onto .., then the next onto the first folder, etc. However, if you do this in Windows explorer, you'll notice different behavaior. I'm always put onto the first item in the list when I enter a folder
BarryG
Addict
Addict
Posts: 4173
Joined: Thu Apr 18, 2019 8:17 am

Re: ExplorerListGadget: two small additions

Post by BarryG »

I thought you meant you wanted an automatic SetActiveGadget() whenever it got populated with AddGadgetItem().

But, setting a gadget item automatically when being added is still something I wouldn't like. I feel the user's current selection(s) shouldn't change just because a new item is added. It would break my app's functionality if it did that.
Quin
Addict
Addict
Posts: 1133
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: ExplorerListGadget: two small additions

Post by Quin »

Not whenever a new item gets added, whenever the user changes directories. If you want to see what I mean in action, go into Windows Explorer, to the root of your C:\ drive, and press down arrow. Note what folder you get moved to. Then repeat the same steps with an ExplorerListGadget(). Windows explorer puts your focus on the first item, PB does not.
BarryG
Addict
Addict
Posts: 4173
Joined: Thu Apr 18, 2019 8:17 am

Re: ExplorerListGadget: two small additions

Post by BarryG »

Quin wrote: Thu Dec 19, 2024 10:41 pm Not whenever a new item gets added, whenever the user changes directories. If you want to see what I mean in action, go into Windows Explorer, to the root of your C:\ drive, and press down arrow. Note what folder you get moved to. Then repeat the same steps with an ExplorerListGadget(). Windows explorer puts your focus on the first item, PB does not.
So I did that, and with Windows Explorer on C: it selects the first folder. With the ExplorerListGadget when active, it selects ".." at the top of the list.

Code: Select all

If OpenWindow(0, 0, 0, 400, 200, "ExplorerListGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  ExplorerListGadget(0, 10, 10, 380, 180, "c:\*.*", #PB_Explorer_MultiSelect)
  SetActiveGadget(0)
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Quin
Addict
Addict
Posts: 1133
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: ExplorerListGadget: two small additions

Post by Quin »

Very interesting, for me if I press Windows+R, type C:\, and press enter, I get landed on my $WINDOWS.~BT folder, the first folder on my drive. If I press down arrow once, I get put on $WINDOWS.~WS, the second folder. Meanwhile, in PB, the behavior you described is totally accurate. Basically my feature request is to have .., or whatever the first item is, be selected whenever the gadget fully populates, like Explorer does.
Post Reply