[Gambas-user] Menus

Hans-Martin Bundeshund bundeshund at ...467...
Tue Aug 3 16:46:42 CEST 2004


Hi!

Am Montag, 2. August 2004 22:40 schrieb Gianni Piccini:
> Anybody knows if there is a method to check if enable or disable menus when
> clicking top level menu? I mean that, if I've a menu like this
>
> File
>   Open
>   Close
>   Exit

OK, I named them in ther menu-editor like File, Open, Close and Exit, just for 
the right understanding.

>
> for example I would like to have Close enabled only if something is open...
> there are some others situations where I can disable menus, but certainly
> the top level menu is the last and most secure (and surely the most
> professional). Obviously, inserting a condition in MenuFile_Click() doesn't
> work.

You can simply control them by using

File.Enabled = TRUE	'Or FALSE
Open.Visible = FALSE	'Or TRUE

Every entry has his properties. In the IDE you can type 'File.' and the 
possible properties are poping up. So you can set Close.Visible/Enabled = 
False by default (in the menu-editor) and set it on 'True' in the subroutine 
where the open-file-dialoge appears (Or where ever you know that there is a 
file to close), after a valid file was choosen...

HTH

HM




More information about the User mailing list