Segna il video come già completato  
Se vuoi, sarebbe utile un giudizio su questo video    
In questo video vedremo come rendere più agevole e l'utilizzo da parte dell'utente della nostra applicazione scritta in Visual Basic 2010, inserendo degli Shortcut che permettano il l'accesso diretto alle funzioni dei nostri controlli, ai controlli che sono presenti sul nostro forum utilizzando invece che il mouse soltanto la tastiera. Nell'ultimo video eravamo rimasti in questa situazione c'è nostre due caselle di testa nome cognome ed un pulsante che permette l'elaborazione di nome cognome e genera un messaggio che ci mostra il nome più cognome. Ora c'è rimasto soltanto da modificare il testo visualizzato sul pulsante per cui prendiamo il tasto sinistro del mouse sul pulsante selezioniamo proprietà Text è inserito il valore di default Button1, selezioniamo e modifichiamo in Mostra risultato che è la funzione di questo pulsante. Siccome il testo visualizzato nella pulsante è troppo lungo per la dimensione standard del pulsante, allora tramite questi riquadri di spostamento possiamo trascinare il nostro controllo. Premendo il tasto sinistro del mouse tenendo premuto trascinando finché il testo non risulta visualizzato completamente potremo adesso pensare al contrasto aggiuntivo cioè aggiungere uno shortcut tramite tastiera ai nostri controlli. uno shortcut per permette di utilizzare le combinazioni di tasti alt più un tasto a scelta per accedere direttamente tramite tastiera alle funzioni che espongono i nostri controlli. Per cui ad esempio la combinazione ALT+TAB, potrebbero attivare il nostro pulsante il tasto o CTRL+C ci potrebbero attivare invece un altro controllo presente sul nostro Form. Per attivare gli shortcut da tastiera in Visual Basic 2010 è necessario inserire una & (e commerciale) all'interno del del proprietà Text e la lettera immediatamente successiva alla & sarà la lettera da premere in combinazione col tasto ALT per attivare lo shortcut. Generalmente si prende in considerazione la lettera più significativa del testo di un controllo ad esempio nel nostro caso nel caso di questo pulsante "mostra risultato" le due lettere che potremmo prendere in considerazione per creare una sorta che possono essere la M di "Mostra" oppure la "R" di "Risultato". Molto dipende anche dagli shortcut tra le combinazioni di tastiere che abbiamo già usato per gli altri controlli. Se ad esempio la "N" è ancora libera allora possiamo usarla tranquillamente. Se un altro controllo facesse già uso della lettera "N", per creare il proprio shortcut saremo costretti a ripiegare su un'altra lettera. In questo caso essendo primo controllo che prende in considerazione possiamo usare tranquillamente la "M" per cui come detto prima aggiungiamo una & davanti alla M di "Mostra". A fianco e vediamo che la "M" nel nostro pulsante presenta un'underscore, un trattino basso. questo punto significa che il nostro shortcut, appena creato ha funzionato correttamente. Per poter fare una prova dobbiamo aggiungere però una notifica dietro il lì che le sul pulsante mostra risultati modo da ritornarci una notifica che il pulsante è stato caricato. Per cui aggiungiamo del codice all'evento clic che comunque sarà un qualcosa che vedremo successivamente per cui adesso è importante concentrarsi non tanto sul codice che verrà scritto quanto sull'evidenza che lo shortcut ha prodotto un risultato che volevamo. Ok, questa breve riga di codice mostra un messaggio a video che ci dà conferma che il pulsante è stato premuto. Per cui ritorniamo in progettazione e salviamo nostro progetto tramite F5 oppure tramite questo pulsante. Come possono vedere il nostro pulsante non fa vedere alcun' undescore oppure trattino basso, non fa vedere alcuna shortcut per questo è necessario premere una volta il pulsante alt e contemporaneamente, se premiamo ALT+M è stato scatenato il clic del pulsante tramite la tastiera per cui non abbiamo assolutamente caricato nulla e sul pulsante tramite il mouse questo dimostra che lo shortcut ha funzionato correttamente. Se vogliamo possiamo fare lo stesso lavoro anche sugli altri controlli, nulla ci vieta di aggiungere uno shortcut alla label etichetta di testo la quale attivi direttamente nella casella di testo a cui fa riferimento questo il metodo standard atterra assegnamo sor carta d'un controllo che non ha una proprietà text oppure la cui proprietà text non è utilizzabile per questi scopi per utilizzare una label per assegnare uno shortcut al controllo ad esso associato. Ad'esempio alla casella di testo è necessario che la proprietà TabIndex della label abbia un valore inferiore alla controllo era cui fa riferimento. La proprietà TabIndex non è altro che l'indice di ordinamento dei controlli all'interno del forum. cinque d'esempio questa nebula varata di index tre milione questo profeta quindi sarà il terzo controllo e come ordinamento a questa casella di testo è stata assegnata l'arte proprietà tra di index uno al controllo lei bolla cognome è stata segnata da cabine quattro a questa casella di testo le due tutto questo per dire che la pressione del tasto Tavor sul nostro forum si permetterà di spostarsi da un controllo all'altro senza utilizzare il mouse seguendo l'ordinamento e che vediamo proprio nelle capitata di index facciamo una prova premendo una volta il tasto TAB andiamo sul primo controllo c'è sul controllo che esatta di index uno che era. Questa casella di testo la proprietà TabIndex riferita a quest'altra casella di testo per cui premendo nuovamente il tasto TAB, ci sposteremo sulla seconda casella di testo vediamo qual'è il controllo sul Form dotato di TabIndex 3. Dovrebbe essere questa label ed è proprio così. Per cui ritorniamo qui premendo il tasto TAB, ci aspetteremo di passare su questa label così non è perché la label, quando ottiene focus, lo restituisce al controllo ha un valore di Tabindex immediatamente successivo. Se il controllo con il TabIndex successivo rispetto alla label sulla quale ci siamo posizionati è anch'essa una label, allora il controllo passerà avanti finché il controllo che ha il focus non sarà un controllo diverso. Per cui se premiamo il tasto TAB ci ritroviamo direttamente col focus sul pulsante mostra risultato c'è mostra risultato si verifichiamo a un TabIndex di sei per cui è proprio l'ultimo del Form, questo significa che i TabIndex tre e il TabIndex quattro sono stati saltati per cui per fare in modo che anche le caselle di testo possano avere il proprio Shortcut dovremo fare in modo che la Label sia inferiore a quello della casella di testo cui fa riferimento. Per cui questa casella di testo ha TabIndex 2 la sua Label ha TabIndex quattro. Per cui vogliamo che questa Label abbia TabIndex uno cioè sia la prima. Quindi assegnamo il TabIndex uno alla casella di testo e avrà un TabIndex immediatamente successivo quindi due. Questa Label avrà un TabIndex tre e questa casella di testo avrà anch'essa un TabIndex immediatamente successivo alla Label cognome. Adesso assegnamo lo shortcut inserendo un & nella proprietà Text della Label Nome e vediamo che nel carattere ci vengono ora sottolineati, cioè è stato assegnato lo shortcut. Abbiamo il progetto pronto ad essere avviato. Avviamolo premendo F5 nella barra degli strumenti di Visual Basic 2010. Proviamo a premere il tasto TAB in modo da passare dalla casella di testo Nome alla casella di testo Cognome senza utilizzare il mouse. Ecco qua ci siamo riusciti premendo le combinazione ALT+M dovremmo riuscire ancora a premere il pulsante senza mouse. E premendo le combinazione ALT+N ci permetterà di tornare alla prima casella di testo. Cosa succede ad esempio se vogliamo utilizzare nella Label Nome il carattere e commerciale? Cioè se ad esempio volessimo che la proprietà Text di Nome fosse nome & cognome? E' evidente che la e commerciale viene interpretata come simbolo di shortcut. Per evitare questo comportamento allora devo scendere fino alla proprietà UseMnemonic e assegnargli il valore False. Ecco che la "e commerciale" & è ritornata "e normale". Questo ci impedirà però di utilizzare gli shortcut come abbiamo fatto in precedenza per cui per ritornare nella condizione precedente dobbiamo riassegnare il valore True a questa proprietà e nel nostro caso ritornare al solo testo nome come proprietà text del controllo label.
In this video we will see how to make it easier and use by the user of our application written in Visual Basic 2010, inserting the shortcut that allow direct access to the functions of our controls, controls that are present on our forum instead using only the keyboard and mouse. In the last video we had been in this situation is both our name and surname textboxes and a button that allows the processing of your name, address and generates a message that shows the name as surname. Now there remained only change the text displayed on the button to which we take the left mouse button select the Text property is added to the default Button1, select and edit to show results that is the function of this button. Since the text displayed in the button is too long for the standard size of the button, then move through these boxes we drag our control. Pressing the left mouse button while holding down drag until the text is displayed fully we now think of the contrast that is additional to add a keyboard shortcut to our control. allows for a shortcut to use the alt key combinations than any button to go directly to the keyboard functions that expose our control. So for example, ALT TAB, could enable our button or the CTRL key instead of C there may activate another control on our Forms To enable keyboard shortcuts in Visual Basic 2010 is necessary to include an & (ampersand) in the Text property of the letter and immediately subsequent to the letter & will be pressed in combination with the ALT key to activate the shortcut. Generally we consider the most significant point of the text of a control such as in our case in the event of this button displays the result "the two letters that we might consider creating a sort that may be the M of" Show "or "R" of "Result". Much also depends on the shortcut between the different keyboards that we already used for other controls. For example, if "N" is still free then we can use it safely. If another control were already using the letter "N" to create your own shortcut we will be forced to fall back on another letter. In this case being the first control that takes into consideration we can safely use the "M" so as I said before we add a & M in front of the "Show". On the side and we see that the "M" in our present un'underscore button, an underscore. this means that our shortcut, just created it worked properly. In order to do a test but we have to add a notification that there behind the button shows results that it returns a notification that the button was loaded. To which we add the code to the click event he will be something that we will see later that it is now important to focus not so much on the code to be written as evidence that the shortcut has produced a result we wanted. Ok, this short line of code displays a message on the screen that gives us confirmation that the button was pressed. So we go back to save our project design and F5 or by using this button. As we can see the button does not see any 'undescore or underscore, does not see any shortcut for this you need to press the alt button and at the same time, if you press ALT M was triggered by the click of a button the keyboard so we have absolutely nothing and uploaded on the button with the mouse it shows the shortcut that has worked well. If we can do the same work on other controls, nothing forbids us to add a shortcut to the label text label which assets directly in the text box that is referenced by this standard method of paper lands assign a control source that has a text property or whose text property is not suitable for these purposes to use a label to assign a shortcut to the control associated with it. Ad'esempio the text box is necessary that the TabIndex property of the label has a value lower than the control was referring to. The TabIndex property is nothing but the index to sort the checks in the forum. five of this nebula as the index launched three million then this prophet will be the third control and how to sort this text box art has been assigned an index of properties between the control her surname bubble was marked by four booths this the two text box to say that all this pressing the Tavor to our forums you will move from one control to another without using the mouse in the order and we see just happened in the index to do a test by pressing TAB go to the first control is the control that it was an accurate index. This text box TabIndex property related to that other text box so that pressing the TAB key, we move on we see what the second text box control with TabIndex on Form 3. It should be this label and it is. So we return here by pressing the TAB key, we expect to pass on this label so it is not because the label, when it gets focus, it returns the control has a tabIndex value immediately following. If the control with TabIndex later than the label on which we placed is also a label, then the control will continue until the control has the focus will not be a different control. So if you press the TAB key we find ourselves directly with the focus on the button shows the result shows no results occur at a TabIndex of six that is the last of the Form, this means that the TabIndex three and four were TabIndex skipped that to make sure that the text boxes can have their Shortcut we need to ensure that the label is lower than that of the text box is referring to. So this text box has its TabIndex 2 Label TabIndex has four. So we want the Label has a TabIndex that is the first. Then assign the TabIndex to a text box and then have a TabIndex immediately following two. This Label will have a three and TabIndex this text box will also have a TabIndex immediately following the label name. Now assign the shortcut by putting a & in the Text property of the Label name and see that we are now highlighted in the character, that has been assigned the shortcut. We have the project ready to be started. Start them by pressing F5 on the toolbar of Visual Basic 2010. Try pressing the TAB key to move from text box to the Name text box without using your mouse. Here we did it by pressing the ALT M should still be able to press the button without a mouse. And by pressing the ALT N will allow us to return to the first text box. What happens for example if we want to use the Label Name the ampersand? That is, if we want the Text property of that name was the name & last name? It 'clear that the ampersand is interpreted as a symbol of shortcut. To avoid this behavior then I must go down to the UseMnemonic property and give it the value False. Here is the ampersand & is back and normal. " This will prevent us, however, to use the shortcuts as we did previously for which to return to the previous condition we reassign the value True to this property and in our case back to plain text name as the text property of label control. Google Traduttore per miei elementi quali:RicercheVideoEmailTelefono