How to check if a radiobutton is selected Monodevelop - monodevelop

I am developing a program in Monodevelop and I have 18 radiobuttons. I want to check which of those buttons is selected.

foreach (Gtk.RadioButton ctrl in table2)
{
if (ctrl.Active)
{
nome = ctrl.label;
}
}
considering that the radiobuttons are within table2

Related

How to delete all history of specific website in google chrome

In google chrome in history section, I want to delete all the histories related to a specific website for example: facebook.com, I can search facebook.com and then select all checkboxes and delete but its a time-consuming work.
Is there any easy way to clear the history of specific websites?
even by writing code or script?
open the history manager, search for facebook.com... do not click all the checkboxes individually. Click the first box, scroll to the bottom of the page and hold shift while clicking the last box, it will select all of them at once.
protip: if you want to visit a website without leaving a history entry, go into incognito mode (control-shift-p).
or, Control-A keyboard shortcut will select all of the checkboxes as well! https://techdows.com/2018/02/chrome-history-page-ctrl-a-now-selects-all-history-items.html#:~:text=Chrome%20history%20Page%3A%20Ctrl%2BA%20now%20selects%20all%20items&text=Now%20the%20addition%20of%20Ctrl,or%20unselect%20multiple%20history%20items.&text=The%20thing%20is%2C%20only%20150,page%20has%20more%20history%20items.
You can use some scripting in the console to click checkboxes for entries with hrefs containing a substring.
This answer uses this other SO answer on a querySelectorAll that works for things inside open shadow DOMs:
function $$$(selector, rootNode=document.body) {
const arr = []
const traverser = node => {
// 1. decline all nodes that are not elements
if(node.nodeType !== Node.ELEMENT_NODE) {
return
}
// 2. add the node to the array, if it matches the selector
if(node.matches(selector)) {
arr.push(node)
}
// 3. loop through the children
const children = node.children
if (children.length) {
for(const child of children) {
traverser(child)
}
}
// 4. check for shadow DOM, and loop through it's children
const shadowRoot = node.shadowRoot
if (shadowRoot) {
const shadowChildren = shadowRoot.children
for(const shadowChild of shadowChildren) {
traverser(shadowChild)
}
}
}
traverser(rootNode)
return arr
}
arr = $$$('[href*="example.com"]');
// this code will need to be updated if the source code for the chrome history browser changes.
arr.map(e => e.closest("#item-info")
.previousElementSibling
.previousElementSibling
).forEach(e=>e.click());
This will click all the matching entries on the current page, and then you can just click the button to delete the checked entries.

Angular -> Can the text in an HTML Select be different than what the user selected from the drop down list?

I am working (in an Angular project) with a form where the user selects something from a HTML Select. from the example below, the "Cat" and "Dog" are optgroup(s) and the other things listed are option(s) attributes. Im wondering if it is possible to have the user select from the drop down, say the "Lion" option, and the text that populates the collapsed version of the drop down to read something like.. Cat: Lion.
Cat
Lion
Bobcat
Dog
Wolf
Clifford
Is it possible to do this with just Angular (not jquery)
thanks!
EDIT:
thanks to the help of shashank sharma's comment i was able to figure it out. i used the example he gave and was able to get it to work by making the label a variable in the typescript and then setting that variable in the onCategorySelection function
thing.component.html
<mat-label>{{animalKingdom}}</mat-label>
thing.component.ts
onCategorySelection(event: MatOptionSelectionChange, groupName: string) {
if (event.isUserInput) {
this.selected = groupName + ':' + event.source.viewValue;
----->>>> this.animalKingdom = groupName + ':' + event.source.viewValue;
}
}
Solution of this problem can't be done with selectionChange event, we have to use onSelectionChange event of MatOption which gives us info of MatOptionGroup.
For example:
<mat-select>
<mat-optgroup *ngFor="let group of categoryGroups"
[label]="group.name">
<mat-option *ngFor="let category of group.options"
[value]="category.value" (onSelectionChange)="onCategorySelection($event, group.name)">
{{category.viewValue}}
</mat-option>
</mat-optgroup>
</mat-select>
and Typescript
onCategorySelection(event: MatOptionSelectionChange, groupName: string) {
if (event.isUserInput) {
this.groupName = groupName;
}
}
I have create a working example for you here.
PS: remember onSelectionChanged() is fired not only when an option is selected but also when it is deselected so if you are using met select with checkbox where we select and deselct onSelectionChanged() will fire both time (can be handled with some checks).

Input Validation for PhoneTextBox in windows phone app 8

i'm developing a windows phone application.in my application i want to make input validation for textbox.i'm using windows phone toolkit :PhoneTextBox
need to alert a Message when user fail to fill the textbox after click the submit button.is there any way to do that?
thanks!
In your Button_click event, add a condition,
if (!String.IsNullOrEmpty(PhoneTextBox.Text))
{
//your action here
}
In your Button's event handler make sure you have:
your eventhandler(){
if(string.IsNullOrWhiteSpace(this.textBox1.Text)) //here "tb" is the textbox name, in case of that give your textbox's name.
{
MessageBox.Show("TextBox is empty");
}
}
Or else try using String.IsNullOrWhiteSpace in order to check whether the string is empty.
if (String.IsNullOrWhiteSpace(Name)) //give the name of your textbox.Text
{
//Handled
}
Reference: String.IsNullOrWhiteSpace Method
On Button_click you have to check. Try following code.
if (!String.IsNullOrEmpty(YourTextBox.Text)) // it check it text box is null or empty
{
//your action here
}

Selectively remove Chrome browsing history

Is it possible to selectively remove items from Google Chrome browsing history? I have a website from my history that wants to be the default everytime I start a search with a specific letter, but I often reference my history to re-find things.
So I would like to remove all history from, say, www.pythonismyfavoritest.com without removing everything; is that possible?
Try searching www.pythonismyfavoritest.com in the search bar in chrome://history/ and then remove each item by clicking the check box in the left and then hitting the "remove selected items" button.
The chrome history api works with url such chrome://history/#q=hello&p=0
Here's something I wrote in JavaScript. It works through the Console Debugger. I tried using it in a bookmark but I get no response from the page.
** // UPDATE (07.28.15)
I added a shorter approach provided by #Denis Gorbachev to the checkbox targeting, which helped shorten some of this code. I also added "auto-stop" functionality, meaning the loop will stop once it has finally cleared the list.
** // UPDATE (08.20.14)I made a few changes to the code, to make it more user friendly. Other users may not be code-savvy, and others may simply prefer convenience. Therefore, I whipped up a couple buttons (start/stop) to control the usage; as well as address some "ASSERTION FAILED" exceptions/errors that were being thrown when attempted to run the script loop.. Enjoy!!
In your address bar, type in the following address to to the meat of the history page.. It's normally loaded in an iframe, with the left-side menu loaded in another frame.. // **
chrome://history-frame/
Next, load your Console Debugger/Viewer by pressing Ctrl+Shift+J(For Mac users, ⌘+⌥+J)
You can also press F12 and select the "Console" tab.
In the Console Debugger/Viewer, copy & paste the following code:
function removeItems() {
removeButton = document.getElementById('remove-selected');
overlayWindow = document.getElementById('overlay');
//revision (07.28.15): Replaced the For Loop targeting the checkboxes, thanks to Denis Gorbachev via comments (02.19.15)
Array.prototype.forEach.call(document.querySelectorAll("input[type=checkbox]"), function(node) {node.checked = "checked"})
setTimeout(function () {
if (removeButton.getAttribute("disabled") !== null) {
removeButton.removeAttribute("disabled")
}
/* revision (08.20.14): no longer binding to that condition, button should no longer be disabled, so click! */
if ((overlayWindow.hasAttribute("hidden")) && (overlayWindow.getAttribute("hidden") !== false)) {
removeButton.click();
}
/* revision (08.20.14): new Interval, to check against the overlay DIV containing the confirmation "Remove" button */
/* Attempting to click the button while the DIV's "hidden" attribute is in effect will cause FAILED ASSERTION */
stopButton = setInterval(function () {
if (overlayWindow.hasAttribute("hidden")) {
if (overlayWindow.getAttribute("hidden") == "false") {
hidden = false
} else {
hidden = true
}
} else {
hidden = false
}
if (!hidden) {
document.getElementById("alertOverlayOk").click();
clearInterval(stopButton)
}
}, 250)
}, 250)
}
//revision (08.20.14): Lets build our buttons to control this so we no longer need the console
//stop button (08.20.14)
var stopButton = document.createElement('button');
stopButton.setAttribute('id', "stopButton");
stopButton.innerHTML = "Stop";
stopButton.style.background = "#800";
stopButton.style.color = "#fff";
stopButton.style.display = "none";
stopButton.onclick = function () {
clearInterval(window.clearAllFiltered);
document.getElementById("stopButton").style.display = "none";
document.getElementById("startButton").style.display = ""
};
//start button (08.20.14)
var startButton = document.createElement('button');
startButton.setAttribute('id', "startButton");
startButton.innerHTML = "Start";
startButton.style.background = "#090";
startButton.style.color = "#fff";
startButton.onclick = function () {
window.clearAllFiltered = setInterval(function () {
/* revision (07.28.15): Stop the Loop automatically if there are no more items to remove */
if(document.getElementById("results-header").innerText=="No search results found."){
document.getElementById("stopButton").click();
}
if (document.getElementById("loading-spinner").getAttribute("hidden") !== null) {
removeItems()
}
}, 250); //adjust Time Here (1500 [millisec] = 1.5sec)
document.getElementById("stopButton").style.display = "";
document.getElementById("startButton").style.display = "none"
};
/* revision (08.20.14): Now we add our buttons, and we're ready to go! */
editingControls = document.getElementById('editing-controls');
editingControls.appendChild(stopButton);
editingControls.appendChild(startButton);
This removeItems function will select loop through all form inputs and check all checkboxes, enable the "Remove Selected Items" button and click it. After a half-second, it'll check if the "Are You Sure" prompt is displayed and, if so, click the "Yes/Remove" button automatically for you so that it will load a new list of items to do this process all over again..
The item is looped using the variable "clearAllFiltered", which is a setInterval loop, which is checking for the status of the "Loading" screen..
To start erasing your filtered history items, you can now click the green Start button.
** // UPDATE (07.28.2015) It will now stop on ITS OWN.
To stop the loop manually, you can now click the red Stop button. Simple as that!
1) Go to your history settings ( chrome://history/ )
2) In the top right hand corner will be a search bar with a 'Search History" button
3) Type in the sitename you want to remove from history, then click the button
4) Click the box on the first one, then scroll to the bottom of the page
5) Press and hold the Shift key, then click the last box (This will check all on that page)
6) Scroll back up and select the 'Remove Selected Items" Button
7) Repeat steps 4-6 until all your Youtube History is gone.
Hopefully Chrome will update this clear history feature, but for now this seems to be the fastest option
Easy way is Shift+Delete.
For example when you type "you", "youtube.com" will be shown as selected in suggestions. Just click Shift+Delete. Then retype "you" and you will see no "youtube.com" in that list anymore.
If you are talking about getting rid of the suggested search/auto-completion... then removing specific items from your chrome://history won't do it (in my experience). I want to fill in more detail to the answer #LacOniC gave.
In the screenshot you can see I typed "ba" and Chrome is suggesting completion based on my browsing history (the items in green).
In my experience, removing specific items from your history will not remove them from showing up in this address bar auto-completion.
To quickly remove these auto complete items:
Start typing a few letters that generate the offending suggestion.
Use your keyboard's arrow keys to select the suggestion you don't like (selected item is highlighted blue in screenshot).
Press shift+delete on windows or shift+fn+delete on mac to remove the selected item.

Can't add new object to KendoUI grid if filter is applied to any column

I use KendoUI grid with popup edit mode. After applying filter to any column it is not possible to add new object correctly. Pressing Add button many times does not show edit popup. But after clearing the filter empty objects are shown in the grid.
Is there any workaround?
I found a workaround. Instead of standard Add button use toolbar template in which add link "Add" with custom handler triggering grid add. In that handler check if filtering is used on grid and if so store current filtering to a var and remove filtering. Also bind to grid "save" and "cancel" events handlers which will apply previous filtering after adding new object (or cancelling).
<kendo:grid-toolbarTemplate>
<div>
<a class="k-button k-button-icontext" onclick="addItemHandler()">Add</a>
...
var gridFilter;
function addItemHandler() {
var table = $("#myGrid").data("kendoGrid");
gridFilter = table.dataSource.filter();
if (gridFilter) {
table.dataSource.filter(null);
}
table.addRow();
}
function gridSavedHandler(e) {
restoreFilter(e.sender);
}
function gridEditCanceledHandler(e) {
e.preventDefault();
e.sender.cancelChanges();
restoreFilter(e.sender);
}
function restoreFilter(table) {
if (gridFilter) {
table.dataSource.filter(gridFilter);
gridFilter = null;
}
}
$(document).ready(pageInitHandler);
function pageInitHandler() {
var table = $("#myGrid").data("kendoGrid");
table.bind("save", gridSavedHandler);
table.bind("cancel", gridEditCanceledHandler);
}
Workaround is complicated one but really works.