|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Aug 2003
Città: addio fabriANO... mò sto a Roma ahò!!
Messaggi: 579
|
[BCB6] i Menu
come faccio da codice ad abilitare/disabilitare una singola voce di un MainMenu? o di un PopupMenu?
thanks!
__________________
Tavshan Pasha Bazar: Oggetti etnici per il relax! |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Jan 2000
Messaggi: 551
|
It is often useful to disable menu commands without removing them from the menu. For example, in a text editor, if there is no text currently selected, the Cut, Copy, and Delete commands are inapplicable. An appropriate time to enable or disable menu items is when the user selects the menu. To disable a menu item, set its Enabled property to false. In the following example, an event handler is attached to the OnClick event for the Edit item on a child form’s menu bar. It sets Enabled for the Cut, Copy, and Delete menu items on the Edit menu based on whether RichEdit1 has selected text. The Paste command is enabled or disabled based on whether any text exists on the Clipboard. void __fastcallTMainForm::EditEditClick(TObject *Sender) { // enable or disable the Paste menu item Paste1->Enabled = Clipboard()->HasFormat(CF_TEXT); bool HasSelection = (RichEdit1->SelLength > 0); // true if text is selected Cut1->Enabled = HasSelection; // enable menu items if HasSelection is true Copy1->Enabled = HasSelection; Delete1->Enabled = HasSelection; } The HasFormat method of the Clipboard returns a Boolean value based on whether the Clipboard contains objects, text, or images of a particular format. By calling HasFormat with the parameter CF_TEXT, you can determine whether the Clipboard contains any text, and enable or disable the Paste item as appropriate. |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Aug 2003
Città: addio fabriANO... mò sto a Roma ahò!!
Messaggi: 579
|
uh, GRAZIE un po' in ritardo scusa per la domanda che è veramente molto scema ma... sono incappato in una delle stranezze del BCB!! in pratica io volevo abilitare/disabilitare sti cosi da una funzione fatta da me (non da un evento) ...e non funzionava! ho provato di tutto.... alla fine la cosa giusta da fare era........
Form1 -> MenuSalva -> Enabled = .... che mmerdaaaaaaaaaaaaaaaaaaaaaaa dovevo specificare Form1 grazie lo stesso, eh!
__________________
Tavshan Pasha Bazar: Oggetti etnici per il relax! |
|
|
|
|
|
#4 |
|
Senior Member
Iscritto dal: Jan 2000
Messaggi: 551
|
Se stai facendo questo per non concedere funzionalità agli utenti
non registrati (o cose simili)... indubbiamente è un ottimo metodo per suicidarsi...(programmatoriamente parlando) Non lo fare! |
|
|
|
|
|
#5 | |
|
Senior Member
Iscritto dal: Aug 2003
Città: addio fabriANO... mò sto a Roma ahò!!
Messaggi: 579
|
sta cosa mi serve per rendere un programma ancora più "professionale"
Quote:
__________________
Tavshan Pasha Bazar: Oggetti etnici per il relax! |
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 10:05.



















