Page 1 of 2
No visual ButtonGadget focus with XP skins
Posted: Sun Jul 25, 2004 3:26 am
by Sparkie
I've probably missed something obvious because I find nothing in a search here in regards to this.
When tabbing through gadgets with XP skins disabled, I get visual confirmation that gadget focus has changed. With XP skins enabled, the ButtonGadgets seem lifeless with no visual change?
In addition to that, using the ampersand(&) in the ButtonGadget text, for underlining an associated accelerator key, doesn't seem to work with XP skins enabled.
Who amongst this great group will guide me to my sanity?
Code: Select all
If OpenWindow(0, 100, 100, 220, 170, #PB_Window_SystemMenu, "Tab Test")
If CreateGadgetList(WindowID(0))
StringGadget(0, 10, 10, 200, 20, "")
StringGadget(1, 10, 40, 200, 20, "")
ButtonGadget(2, 10, 70, 200, 20, "Button&1")
StringGadget(3, 10, 100, 200, 20, "")
ButtonGadget(4, 10, 130, 200, 20, "Button&2")
ActivateGadget(0)
EndIf
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
End
Posted: Sun Jul 25, 2004 8:23 am
by plouf
works here here is an example i have use TAB to go to 'button1'
http://homepages.pathfinder.gr/ploufus/Clipboard02.png
Posted: Sun Jul 25, 2004 9:27 am
by thefool
the buttons dont get selected here.
Posted: Sun Jul 25, 2004 10:26 am
by Nico
Don't work for me! 8O
Posted: Sun Jul 25, 2004 10:52 am
by Num3
Hum...
When i was finishing the Lib_Installer i noticed that if i enabled XP skin Support all TextGadgets would get weird background colors under some skins
Could it be a manifest problem ???
Posted: Sun Jul 25, 2004 10:55 am
by thefool
i try to awoid using xp skin if i can. I like flat gadgets and flatbuttons and flat textboxes are looking great, and works under all operation systems. (btw im using your flatgadget lib num3. makes it faster to flatter all gadgets on a big form.). but sometimes the winxp skin is prettiest
Posted: Sun Jul 25, 2004 1:35 pm
by Sparkie
@plouf - Thanks for having proof of a working example and
@ everyone else who had the same results as me.
The partial solution is to go to
Display Properties
Appearance
Effects
Un-check the *Hide underlined letters for keyboard navigation until I press the Alt key*
results:
Underline letter shows up as expected
I get a visual that the button has focus
Check the *Hide underlined letters for keyboard navigation until I press the Alt key*
results:
No underline letters when pressing the Alt key
No visual button focus
(edited to add) : having the *Hide underlined letters for keyboard navigation until I press the Alt key* checked works fine in other apps, it's just the PB apps that don't react as expected to the Alt key
Posted: Fri Mar 11, 2005 7:27 am
by sverson
Sparkie wrote:...having the *Hide underlined letters for keyboard navigation until I press the Alt key* checked works fine in other apps, it's just the PB apps that don't react as expected to the Alt key
I still have this problem
>>underlined letters appear in debugger mode - but not in exe-files<<

Posted: Fri Mar 11, 2005 4:11 pm
by Sparkie
After further investigation (Googling), it appears that this behavior is by design in XP
This bit of code makes things work as expected
if XP Skins is enabled and
Hide underlined letters for keyboard navigation until I press the Alt key is turned on in XP Display Properties --> Appearance --> Effects.
Code: Select all
#WM_QUERYUISTATE = $129
#WM_UPDATEUISTATE = $128
#UIS_CLEAR = 2
#UIS_SET = 1
#UISF_HIDEACCEL = 2
#UISF_HIDEFOCUS = 1
Procedure MakeLong(low.w, high.w)
ProcedureReturn (high * $10000) | (low & $FFFF)
EndProcedure
Procedure myWindowCallback(hWnd, msg, wParam, lParam)
Shared uiState
result = #PB_ProcessPureBasicEvents
Select msg
;--> Entering Menu Loop, turn on accelerator underlining
Case #WM_ENTERMENULOOP
;--> Check if underlining is turned off
uiState = SendMessage_(WindowID(0), #WM_QUERYUISTATE, 0, 0)
;--> if so, turn it on
If uiState &#UISF_HIDEACCEL
SendMessage_(WindowID(0), #WM_UPDATEUISTATE, MakeLong(#UIS_CLEAR, #UISF_HIDEACCEL), 0)
EndIf
;--> Exiting Menu Loop, turn off accelerator underlining
Case #WM_EXITMENULOOP
If uiState &#UISF_HIDEACCEL
SendMessage_(WindowID(0), #WM_UPDATEUISTATE, MakeLong(#UIS_SET, #UISF_HIDEACCEL), 0)
EndIf
EndSelect
ProcedureReturn result
EndProcedure
If OpenWindow(0, 100, 100, 220, 170, #PB_Window_SystemMenu, "Tab Test") And CreateGadgetList(WindowID(0))
SetWindowCallback(@myWindowCallback())
If CreateMenu(0, WindowID()) ; here the menu creating starts....
MenuTitle("&Project")
MenuItem(1, "&Open" +Chr(9)+"Ctrl+O")
MenuItem(2, "&Save" +Chr(9)+"Ctrl+S")
MenuItem(3, "Save &As"+Chr(9)+"Ctrl+A")
MenuItem(4, "&Close" +Chr(9)+"Ctrl+C")
EndIf
StringGadget(0, 10, 10, 200, 20, "")
ButtonGadget(1, 10, 70, 200, 20, "Button&1")
StringGadget(2, 10, 100, 200, 20, "")
ButtonGadget(3, 10, 130, 200, 20, "Button&2")
ActivateGadget(0)
;--> Check if focus is turne off
uiState = SendMessage_(WindowID(0), #WM_QUERYUISTATE, 0, 0)
;--> If so, turn it on
If uiState &#UISF_HIDEFOCUS
SendMessage_(WindowID(0), #WM_UPDATEUISTATE, MakeLong(#UIS_CLEAR, #UISF_HIDEFOCUS), 0)
EndIf
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
EndIf
End
Posted: Fri Mar 11, 2005 11:07 pm
by sverson
THX Sparkie
Do you know why it works in debugger mode without this callback?
You can disable
SetWindowCallback(@myWindowCallback())
Code: Select all
...
If OpenWindow(0, 100, 100, 220, 170, #PB_Window_SystemMenu, "Tab Test") And CreateGadgetList(WindowID(0))
;SetWindowCallback(@myWindowCallback())
If CreateMenu(0, WindowID()) ; here the menu creating starts....
...
In debugger mode underlined letters are allways swicted on and button focus is visible ->
PB compiler bug?!?

sverson
Posted: Fri Mar 11, 2005 11:25 pm
by Sparkie
sverson wrote:In debugger mode underlined letters are allways swicted on and button focus is visible
That's not the case for me. The only way that works here is by sending the #WM_UPDATEUISTATE messages.
XP skins enabled (PB Compiler options)
Hide underlined letters for keyboard navigation until I press the Alt key enabled (WinXP Display properties)
Debugger on
I don't see focus rect or underlined accelerators
Debugger off
Same results
Do you have any code for me to test?
Posted: Sat Mar 12, 2005 1:31 am
by sverson
Sorry

my mistake!
It's not a debugger - it's a
jaPBe problem!
When I press
F5 to start your demo from
jaPBe the buttons allways have underlined letters (and selection is shown) even if I disable all your additional code. Menus are not affected! - ALT still works there!
Code: Select all
If OpenWindow(0, 100, 100, 220, 170, #PB_Window_SystemMenu, "Tab Test") And CreateGadgetList(WindowID(0))
;SetWindowCallback(@myWindowCallback())
If CreateMenu(0, WindowID()) ; here the menu creating starts....
MenuTitle("&Project")
MenuItem(1, "&Open" +Chr(9)+"Ctrl+O")
MenuItem(2, "&Save" +Chr(9)+"Ctrl+S")
MenuItem(3, "Save &As"+Chr(9)+"Ctrl+A")
MenuItem(4, "&Close" +Chr(9)+"Ctrl+C")
EndIf
StringGadget(0, 10, 10, 200, 20, "")
ButtonGadget(1, 10, 70, 200, 20, "Button&1")
StringGadget(2, 10, 100, 200, 20, "")
ButtonGadget(3, 10, 130, 200, 20, "Button&2")
ActivateGadget(0)
; ;--> Check if focus is turne off
; uiState = SendMessage_(WindowID(0), #WM_QUERYUISTATE, 0, 0)
; ;--> If so, turn it on
; If uiState &#UISF_HIDEFOCUS
; SendMessage_(WindowID(0), #WM_UPDATEUISTATE, MakeLong(#UIS_CLEAR, #UISF_HIDEFOCUS), 0)
; EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
When I start
the same exe from ...\PureBasic\Compilers\PureBasic9762296.exe (where jaPBe stores the exe started via F5) buttons have no underlined letters and selection is not shown but ALT still works on menus.

very strange thing!
XP skins enabled (PB Compiler options)
OK
Hide underlined letters for keyboard navigation until I press the Alt key enabled (WinXP Display properties)
OK


It's supposed to be the same exe?!?!
left: jaPBe-F5 / right: ...\PureBasic\Compilers\PureBasic9762296.exe
Button2 is selected in both cases.
Posted: Sat Mar 12, 2005 2:01 am
by Sparkie
Ok, now I see what you mean. I have no idea why it's doing that, maybe GPI will come along and shed some light on this.

Posted: Sat Mar 12, 2005 2:50 am
by Sparkie
I just tried your code within PB IDE and same results as jaPBe.
Something else I noticed in both jaPBe and PB IDE is that if you select Compile / Run from the menu, the focus is lost and no underlines for accelerators. The shortcut for this menu item is F5. So why different results with the same menu item?
I also noticed that memory consumption is about 4k less when using F5 shortcut.

...it's getting mysterious...
Posted: Sat Mar 12, 2005 3:05 am
by sverson
Now it's getting mysterious!
The same exe behaves different depending on the way you call it!

In both cases CheckBox1 is selected!
left: call via EnterKey -> underlined letters and selection OK
right: call via MouseKlick -> underlined letters and selection NOT OK
So it seems not to be GPIs problem. The jaPBe call is like a EnterKey call.
Code: Select all
If OpenWindow(0, 100, 100, 220, 170, #PB_Window_SystemMenu, "Tab Test") And CreateGadgetList(WindowID(0))
If CreateMenu(0, WindowID())
MenuTitle("&Project")
MenuItem(1, "&Open" +Chr(9)+"Ctrl+O")
MenuItem(2, "&Save" +Chr(9)+"Ctrl+S")
MenuItem(3, "Save &As"+Chr(9)+"Ctrl+A")
MenuItem(4, "&Close" +Chr(9)+"Ctrl+C")
EndIf
StringGadget(0, 10, 10, 200, 20, "")
CheckBoxGadget(1, 10, 40,200, 20, "&CheckBox1")
ButtonGadget(2, 10, 70, 200, 20, "Button&1")
StringGadget(3, 10, 100, 200, 20, "")
ButtonGadget(4, 10, 130, 200, 20, "Button&2")
ActivateGadget(0)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
End
My system: WIN XP - PB 3.93

sverson