Page 1 of 1
Can you disable the TAB jumping on a gadget?
Posted: Tue Jan 02, 2007 6:13 pm
by DoubleDutch
You can do this on windows with:
Code: Select all
Procedure NoTabJump(gadget)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
If IsGadget(gadget)
style=GetWindowLong_(GadgetID(gadget),#GWL_STYLE)
SetWindowLong_(GadgetID(gadget),#GWL_STYLE,style&((-1)-#WS_TABSTOP))
EndIf
CompilerEndIf
EndProcedure
But is there anyway to do the same in Linux?
Posted: Wed Jan 03, 2007 3:16 pm
by FloHimself
Check if this works for you:
Code: Select all
Procedure NoTabJump(gadget)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
If IsGadget(gadget)
style=GetWindowLong_(GadgetID(gadget),#GWL_STYLE)
SetWindowLong_(GadgetID(gadget),#GWL_STYLE,style&((-1)-#WS_TABSTOP))
EndIf
CompilerEndIf
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
If IsGadget(gadget)
*obj.GtkObject = GadgetID(gadget)
*obj\flags = *obj\flags &~ (1 << 11)
EndIf
CompilerEndIf
EndProcedure
Posted: Wed Jan 03, 2007 8:51 pm
by DoubleDutch
FloHimself: No, that doesn't seem to do it.
Posted: Wed Jan 03, 2007 9:02 pm
by FloHimself
oh, maybe I misunderstood.
Do you want
a) to hold the focus on one specific gadget
or
b) to exclude a gadget from getting the focus when "tab'ing"?
The code above should do b). Can't test your function on Windows...
Posted: Wed Jan 03, 2007 9:24 pm
by DoubleDutch
b) Exclude the gadget from getting the focus when tabbing
- It does get the focus when tabbing though...
I'll have another go.
Posted: Wed Jan 03, 2007 9:33 pm
by DoubleDutch
Strange, its working now???
But the focus doesn't go back to the 1st gadget on after the 2nd is tabbed - it gets stuck on the 2nd. You have to click the 1st again to select it.
Posted: Wed Jan 03, 2007 11:08 pm
by FloHimself
Strange! I've tested with this:
Code: Select all
Procedure NoTabJump(gadget)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
If IsGadget(gadget)
style=GetWindowLong_(GadgetID(gadget),#GWL_STYLE)
SetWindowLong_(GadgetID(gadget),#GWL_STYLE,style&((-1)-#WS_TABSTOP))
EndIf
CompilerEndIf
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
If IsGadget(gadget)
*obj.GtkObject = GadgetID(gadget)
*obj\flags = *obj\flags &~ (1 << 11)
EndIf
CompilerEndIf
EndProcedure
If OpenWindow(0, 0, 0, 222, 105, "ButtonGadgets", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
ButtonGadget(0, 10, 10, 200, 0, "Button 0")
ButtonGadget(1, 10, 40, 200, 0, "Button 1")
ButtonGadget(2, 10, 70, 200, 0, "Button 2")
NoTabJump(2)
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
And get this:
http://www.youtube.com/watch?v=5O-6q_p_p-I
Posted: Thu Jan 04, 2007 1:05 am
by DoubleDutch
It may depend on gadget type?
Does the latest Linux version of CutTheCosta tab stop at the end or start again at the beginning on your system?
Posted: Thu Jan 04, 2007 9:35 am
by FloHimself
It stops at the end.
Posted: Thu Jan 04, 2007 10:46 am
by DoubleDutch
It must be something to do with gadget type?
Posted: Thu Jan 04, 2007 11:08 am
by FloHimself
Maybe, but it should work on any Widget with a GTK_CAN_FOCUS flag.
You can check for that flag with this:
Code: Select all
Procedure CanGetFocus(gadget)
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
If IsGadget(gadget)
*obj.GtkObject = GadgetID(gadget)
If ((*obj\flags & (1 << 11)) <> 0)
ProcedureReturn #True
EndIf
EndIf
CompilerEndIf
ProcedureReturn #False
EndProcedure
Maybe this is wrong:
Code: Select all
*obj\flags = *obj\flags &~ (1 << 11)
But it should work as expected and it does here for the gadgets I've tested.