How to select tab programmatically? - vmware-clarity

I need to switch from current tab to another without clicking on the tab itself.

In Clarity's documentation, you can see that the *clrIfActive directive accepts a boolean input to force a tab to activate.
So in your case, just pass true to the *clrIfActive of the tab you want to programmatically select. How you do that depends on how you create your tab in the first place: statically, with an *ngFor, based on a specific tab model, ... We can't help you out more unless you provide an example of what you are trying to do.

Related

Simulating button click in Tcl/TK R package

I would like to simulate a button click to switch from one tab to another after a specific action has been performed. I.e. say there are two tabs, and I am currently located in the second tab. I click a button in the second tab which calls a function that changes the second tab to the first tab. I am not sure how to "mimic" the button click that Tcl/TK handles when switching tabs using the mouse. Is there a way to do this? Thank you!
Tab notebooks have a select method that does tab selection. Which tab to switch to can be chosen by a few schemes, but the important ones for most code are:
By index (counting from zero; 0 for the first tab, 1 for the second, ...)
By handle of managed child widget (often a frame, but not necessarily)

How to match specific content of a drop down in TOSCA without selecting it?

Is there a way to verify that if a drop down contains a specific option without selecting that option in TOSCA?
Yes there that is possible. I tried it with a standard HTML combobox. For that you need to scan the page. Select the combobox in question and change the quickfilter to show the items from the drop down. Check the combobox itself and one of the items below (does not matter which one):
You can ignore the message that the item is not unique - just create the module.
Once you have the module in place, you can rename the item, so that it reflects that you want to use it as a generic item. Then (in the properties tab) add a 'Configuration Parameter' and call it 'ExplicitName' and set it's value to true. This will allow to edit the name of the item in the testcase. (more details in the help of Tosca 11.1)
You can then create a testcase and use the module on it. In the testcase you can change the name of the item to the text of the drop down item you want to check for (you can also use wildcards) and then verify that it exists.

How to: Allow for a ListBox to have no selection

I am wanting to allow for a user to deselect all values in a ListBox. Normally, when the user deselects all but one item, that one item cannot be deselected. I want to make it so it can be.
Thanks
Essentially I'm aware of two ways of doing this:
Add an empty item to the list. You can even name this item "None" or something similar. Using a text has the additional advantage that it informs the user.
Use JavaScript to unselect the item that is clicked if it is the last item.
Note, either way, you change the default behavior of the listbox, which is what users are accustomed to. Changing the default behavior is generally not a good idea, which is why I would go for option (1) being the clearest towards your users.

Is it possible to catch a comboBoxes value before change with a change event

I am displaying a combo box in something of a WYSIWYG preview. I want the user to be able to click on the combo box and see the options inside, but I don't want them to be able to change the value. I tried using preventDefault() on the change event but it doesn't work. I don't want to disable it because I do want the user to be able to "look inside" the dropdown.
So I'm trying to block the change, but can't. My next resort is to change the selected index back to what it was before the change, Is there any way to do this within the scope of a ListEvent.CHANGE event listener?
Current Workaround is to basically re-assign the controls selected item the same way I am defining the selected item when I originally build it (a default selection). So a user sees their change then it immediately changes back to the default selection.
Are you sure that a combobox is what you want? could you do the same thing with a list component that is not selectable?
update:
If you must use a combobox and you dont want the lag from listening for the event and resetting the control, I see two possible options. You could subclass the control and make your own. When you do, hijack any methods that set the value besides the initial selection.
Or, you could try something like this: http://wmcai.blog.163.com/blog/static/4802420088945053961/. The site seems like it is in another language but the code is still there. It will allow you to make your options disabled, so the user cannot choose one of the other options.
HTH

How can I disable an individual item in a combo box in Flex so that it is not clickable?

I want to create a combobox in flex which will take three values, Available, Unavailable, and Busy. The constraint is, I should not allow user to go directly from Unavailable to Busy. So when a User is selected Unavailable, I should keep the Busy item disabled (unselectable), but a user will be able to go directly from Available to Busy. I chouldn't find a straight forward way to disable an item in combobox in Flex. How can I do that?
Have you considered using radio buttons rather than a combo box? It's clear how to do this for radio buttons, for one thing. Also, it can often be friendlier to present the available options without requiring a click to reveal them. (Especially if, as in this case, you are adding the possibility that an option is "available, but not possible for you right now for some reason not shown in this combo-box item").
If you really want a combo-box, you can use the click event to display it in a non-standard fashion by probably changing its style; and then, if clicked anyway, Then, in the selected event, reject the choice (hopefully with an indication of why),
Or, if you want to simply remove it from the list, you can have the click listener event repopulate the source list each time, based on conditions. But that might be confusing to the user, too.
You can also have a look at
www.stoimen.com/blog/2009/03/05/flex-3-combobox-disabled-options/
which references
wmcai.blog.163.com/blog/static/4802420088945053961/
(note for NoScript users you must have 163.com and 126.com at least temporarily allowed to be
able to properly see this page)
it works very well even though I added the code for being able to properly handle keyboard
events in the dropdown list
Full self working example available at
http://olivierbourdon.homedns.org/OpenSource/combos.zip
Thanks again for the good work

Resources