Page 2 of 2

Re: SDI Example with Window Key Navigation

Posted: Tue Jan 25, 2011 6:25 am
by Frarth
TomS wrote:The Code from the first post looks like it works on my Win7 32bit (at least it shows the gadgets).
Escape and Enter close the window, Arrowkeys only work in the ComboBox, not with RadioButtons.
Furthermore after clicking any RadioButton, its text changes into "€" (or whatever I type into the Curreny StringGadget), but don't change after another click, regardless of what's in the Currency Gadget.
Do you see focus rings on radio and push buttons? If so, you should be able to see those buttons shift focus with the left and right arrow keys.

The text change happens here as well, so I'll have a look into that. Thanks for the reply!

Re: SDI Example with Window Key Navigation

Posted: Tue Jan 25, 2011 6:29 am
by Frarth
OK, I have found the problem of the text change. Paste this code in the procedure Notation_EventGadget:

Code: Select all

Select Gadget
    Case #Notation_Button_OK
      If Notation_Button_OK()
        ProcedureReturn #True
      EndIf
    Case #Notation_Button_Cancel
      ProcedureReturn #True
    Default
      If Event = #PB_Shortcut_Return
        If Notation_Button_OK()
          ProcedureReturn #True
        EndIf
      ElseIf Gadget = #Notation_String_CurrencySign
        LimitStringGadget(Gadget, #Notation_CurrencySign_Size)
      EndIf
  EndSelect
I have also updated the code in the first post.

Re: SDI Example with Window Key Navigation

Posted: Tue Jan 25, 2011 7:48 am
by Frarth
Another interesting fact: If a PB program (with a dialog opened) has the focus, and you start another program (say Windows Explorer), before losing focus GetActiveGadget returns -1. A good thing I believe, but I had to adjust the code in the above example a bit to avoid a "Gadget not initialized" error. Code above updated... :D

Re: SDI Example with Window Key Navigation

Posted: Tue Jan 25, 2011 9:03 am
by Kwai chang caine
ts-soft wrote:No changes. Only a question sign in the white small quader.
greetings - thomas
I have testing the first code, and i'm like TsSoft.
My dream it's a day to be like TsSoft.....but for this time....it's not a real pleasure :lol: :lol:

Re: SDI Example with Window Key Navigation

Posted: Tue Jan 25, 2011 3:53 pm
by TomS
Frarth wrote:Do you see focus rings on radio and push buttons? If so, you should be able to see those buttons shift focus with the left and right arrow keys.

The text change happens here as well, so I'll have a look into that. Thanks for the reply!
No, I don't see focus rings, but selecting with arrow keys and space works.
It was a misunderstanding.
I thought the arrow keys select another option, rather than just putting the focus on it.
But since there are no focus indicators, it appears as if it's not working.

A focus rectangle appears when using SetActiveGadget() (but works only kinda randomly...)
Then I can switch to the next/previous option via Tab / Shift+Tab.
With Space I can select this option. (This is not possible without the focus rectangle).
The focus rectangle is still there, but Tab doesnn't move it.
Seems like another great idea from microsoft to make the UI "easier" to understand (whatever...)

Text change issue is now fixed. Good!

Re: SDI Example with Window Key Navigation

Posted: Tue Jan 25, 2011 5:31 pm
by Frarth
TomS wrote:
Frarth wrote:Do you see focus rings on radio and push buttons? If so, you should be able to see those buttons shift focus with the left and right arrow keys.

The text change happens here as well, so I'll have a look into that. Thanks for the reply!
No, I don't see focus rings, but selecting with arrow keys and space works.
It was a misunderstanding.
I thought the arrow keys select another option, rather than just putting the focus on it.
But since there are no focus indicators, it appears as if it's not working.

A focus rectangle appears when using SetActiveGadget() (but works only kinda randomly...)
Then I can switch to the next/previous option via Tab / Shift+Tab.
With Space I can select this option. (This is not possible without the focus rectangle).
The focus rectangle is still there, but Tab doesnn't move it.
Seems like another great idea from microsoft to make the UI "easier" to understand (whatever...)

Text change issue is now fixed. Good!
I had the same problem; no focus rings. But that is a Windows issue. Go to -> Display Properties -> Appearance -> Effects. Uncheck "Hide underlined letters for keyboard navigation until I press the Alt key".

It worked for me. Btw, I do use SetActiveGadget in the example above.

- Tab is not supposed to move the focus ring within a group of radio buttons.