Sierra & PB 5.60: Tab order is a disaster

Mac OSX specific forum
User avatar
kpeters58
Enthusiast
Enthusiast
Posts: 341
Joined: Tue Nov 22, 2011 5:11 pm
Location: Kelowna, BC, Canada

Sierra & PB 5.60: Tab order is a disaster

Post by kpeters58 »

Taborder on my forms works perfectly under Windows; under OS X it feels like it's using a randomizer. All over the place with a number of gadgets entirely ignored.

Bug / knows issues / way to fix it?
PB 5.73 on Windows 10 & OS X High Sierra
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Sierra & PB 5.60: Tab order is a disaster

Post by wilbert »

In the System Preferences / Keyboard you can configure the OS to allow the tab key for all controls.
It's located under shortcuts. It should also be possible to toggle this option by pressing Control + F7 .
(On my keyboard F7 has a media function by default so I had to press fn + Control + F7).

As for the tab order, do you have some example code ?
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
kpeters58
Enthusiast
Enthusiast
Posts: 341
Joined: Tue Nov 22, 2011 5:11 pm
Location: Kelowna, BC, Canada

Re: Sierra & PB 5.60: Tab order is a disaster

Post by kpeters58 »

Thanks for that - it works a lot better when that option is set.

As for what still goes wrong:

Imagine 4 string gadgets in a 2 x 2 matrix - set up so that the order should be:
1) Top Left
2) Bottom Left
3) Top Right
4) Bottom Right

This works well under Windows.

OS X does not respect that and enforces this:
1)Top Left
2) Top Right
3) Bottom Left
4) Bottom Right

I.e., rows have precedence over columns - maybe some foolish attempt of trying to enforce some GUI guidelines??
PB 5.73 on Windows 10 & OS X High Sierra
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3870
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Sierra & PB 5.60: Tab order is a disaster

Post by wilbert »

After some reading online ...
It's called the "key view loop" and by default a NSWindow calculates it automatically.
It is possible to set the tab order manually.

Code: Select all

OpenWindow(0, 0, 0, 430, 110, "StringGadget tab order", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)

; >> Disable automatic tab order calculation <<
WindowID0 = WindowID(0)
CocoaMessage(0, WindowID0, "setAutorecalculatesKeyViewLoop:", #NO)

; >> Add gadgets <<
StringGadget(0, 10, 10, 200, 20, "1")
StringGadget(1, 10, 40, 200, 20, "2")
StringGadget(2, 220, 10, 200, 20, "3")
StringGadget(3, 220, 40, 200, 20, "4")
ButtonGadget(4, 10, 70, 410, 30, "Button")

; >> Manually set tab order ; <<
GadgetID0 = GadgetID(0)
GadgetID1 = GadgetID(1)
GadgetID2 = GadgetID(2)
GadgetID3 = GadgetID(3)
GadgetID4 = GadgetID(4)
CocoaMessage(0, GadgetID0, "setNextKeyView:", GadgetID1)
CocoaMessage(0, GadgetID1, "setNextKeyView:", GadgetID2)
CocoaMessage(0, GadgetID2, "setNextKeyView:", GadgetID3)
CocoaMessage(0, GadgetID3, "setNextKeyView:", GadgetID4)
CocoaMessage(0, GadgetID4, "setNextKeyView:", GadgetID0)
CocoaMessage(0, WindowID0, "setInitialFirstResponder:", GadgetID0)

; >> Event loop <<
Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Windows (x64)
Raspberry Pi OS (Arm64)
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Sierra & PB 5.60: Tab order is a disaster

Post by mk-soft »

My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Post Reply