This Question is Answered

15 "helpful" answers available (3 pts)
2 Replies Last post: Nov 5, 2007 10:30 PM by Tony

Don't want to tab to one control and make the control can take focus at the same time.

Nov 5, 2007 6:23 PM

Click to view Tony's profile Level 2 Tony 26 posts since
Oct 17, 2007
Now when I don't want to tab to one control, there are two methods. One is to set enabled property as false, the other is to set the takes-focus? property as false.However I want the control can take focus and don't wanna tab to it, How to do it?
Click to view Kamal's profile Curl Kamal 99 posts since
Oct 17, 2007
1. Re: Don't want to tab to one control and make the control can take focus at the same time. Nov 5, 2007 8:46 PM

Basically you want the control not participate in the traversal. For this you will need to subclass the control and override the "become-active-from-traversal" method. It should return false. Here is some code that makes the CommandButton (a control) behave the way you want.

{define-class package MyCommandButon {inherits CommandButton}
{constructor package {default
label:#Label = "CommandButton", ||""
reactive-label:#ReactiveLabel = null,
style:CommandButtonStyle =
CommandButtonStyle.standard,
text-breakable?:bool = false,
ui-object:#CommandButtonUI = null,
...
}
{construct-super
label = label,
reactive-label = reactive-label,
style = style,
text-breakable? = text-breakable?,
ui-object = ui-object,
...
}
}

{method public open {become-active-from-traversal forward?:bool=true}:bool
{return false}
}
}


This button "MyCommandButton" will take focus, but will not participate in the traversal.

Click to view Tony's profile Level 2 Tony 26 posts since
Oct 17, 2007
2. Re: Don't want to tab to one control and make the control can take focus at the same time. Nov 5, 2007 10:30 PM
in response to: Kamal
Ok, It works fine:)