New topic: 

Need Help enabling menu items

<http://forums.realsoftware.com/viewtopic.php?t=46187>

         Page 1 of 1
   [ 8 posts ]                 Previous topic | Next topic          Author  
Message        IamKJVonly          Post subject: Need Help enabling menu 
itemsPosted: Mon Dec 10, 2012 8:14 am                         
Joined: Sun Oct 01, 2006 8:13 am
Posts: 47                I have a menu (Menu1) a which has several items across 
the top ot it.

One of the items is:  "PrintListing".  I want to be able to control when the 
user can select this menu option (In other words grey it out when I don't want 
the user to use this menu optiom)

I've tried "PrintListing.enabled = true  & false but nothing seems to change.  
(Also I've tried enable with out any luck)

In addition; I want to put two items under the "PrintLinting" and want to be 
able to enabe or disable each menu item as needed.

I've tried everything I can think of without any luck it to work.

Can anyone show me the code to make this work. I just can't seem to find the 
right combination or I'm using the wrong approach.

Dave   

PS: I've looked in the language reference manual and can't find any thing 
useful in a search.      
_________________
I'm using windows 7 (64 bit) and Real Studio 2012,r1.2 (Romans 10:9-10)  
                             Top                Bimal          Post subject: 
Re: Need Help enabling menu itemsPosted: Mon Dec 10, 2012 8:27 am               
          
Joined: Mon Jan 16, 2012 8:08 am
Posts: 157
Location: India                Hi IamKJVonly,
 
Did u add the menu handler "PrintListing" . Please check.

Thanks
bimal.   
                             Top                amitavak          Post subject: 
Re: Need Help enabling menu itemsPosted: Mon Dec 10, 2012 9:33 am               
                  
Joined: Mon Jan 02, 2012 1:51 am
Posts: 379
Location: India                I think you can't disable the top menus in the 
MenuBar. But the child menus under the top menus can be enable/disable via 
code. But that should be done in the "EnableMenuItems" event. If you uncheck 
the "AutoEnable" property of a MenuItem, then by default it will be disable. 
You just need to call "MenuItem.Enable()" as per your condition to enable the 
MenuItem.      
_________________
Amitava Karan
Real Studio 2012 Release 1
Windows 7 (32 bit)
Mac OS X Version 10.7  
                             Top                IamKJVonly          Post 
subject: Re: Need Help enabling menu itemsPosted: Mon Dec 10, 2012 1:53 pm      
                   
Joined: Sun Oct 01, 2006 8:13 am
Posts: 47                Thanks to your help I think I have found to do it now.

PrintListing.autoenable = true
PrintListing.autoenable = false

Does what I want it to do.  However you are right in that it will not work on 
the top menus in the MenuBar. So I moved it to a lower level.

I'm sorry I just couldn't get the "enable" to work and gave up on it when I got 
the autoenable to do what I wanted.

Thanks for the help  I would not have gotton this far without it.

Dave

PS:  I did have menu handlers for all items.      
_________________
I'm using windows 7 (64 bit) and Real Studio 2012,r1.2 (Romans 10:9-10)  
                             Top                DaveS          Post subject: 
Re: Need Help enabling menu itemsPosted: Mon Dec 10, 2012 2:09 pm               
                  
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4331
Location: San Diego, CA                menuitem.enabled=true or false

is the correct way to do it....  and it should be done in the ENABLEMENUITEMS 
event      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                IamKJVonly          Post 
subject: Re: Need Help enabling menu itemsPosted: Mon Dec 10, 2012 3:35 pm      
                   
Joined: Sun Oct 01, 2006 8:13 am
Posts: 47                I'm sorry but I seem to be having a bad day. I just 
can't follow what you are tying to tell me.

the commands 
PrintListing.enabled= true
PrintListing.enabled= false

do not work for me. Is the printListing.autoenable suppose to be true or false 
at this point?

And I don't understand how I get into the ENABLEMENUITEMS event. I put the 
ENABLEMENUITEMS after I do a PrintListing.enabled command but the menu doesn't  
change.

Maybe if I sleep on it tonight it will make more sense tomorrow.

Thanks for trying 

Dave      
_________________
I'm using windows 7 (64 bit) and Real Studio 2012,r1.2 (Romans 10:9-10)  
                             Top                DaveS          Post subject: 
Re: Need Help enabling menu itemsPosted: Mon Dec 10, 2012 3:46 pm               
                  
Joined: Sun Aug 05, 2007 10:46 am
Posts: 4331
Location: San Diego, CA                Look at the property/events for the form 
(left side panel)

Under EVENTS is ENABLEMENUITEMS

put code in there to decide when to enable a menuitem or not


and you never call ENABLEMENUITEMS directly... the system does it for you ... 
you just have to add code to tell it what to do WHEN it does call it.      
_________________
Dave Sisemore
MacPro, OSX Lion 10.7.4 RB2012r1
Note : I am not  interested in any solutions that involve custom Plug-ins of 
any kind  
                             Top                IamKJVonly          Post 
subject: Re: Need Help enabling menu itemsPosted: Tue Dec 11, 2012 8:21 am      
                   
Joined: Sun Oct 01, 2006 8:13 am
Posts: 47                Thanks DaveS
For being so patience with me.  Believe it or not you are really helping me 
look at Real Basic functions in a whole new light.

With you help the light bulb came on this morning and I now am doing it the 
right way.

Thanks for for your help.

Dave      
_________________
I'm using windows 7 (64 bit) and Real Studio 2012,r1.2 (Romans 10:9-10)  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 8 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to