FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour oMenu:Disable()
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
oMenu:Disable()
Posted: Sat Mar 17, 2007 02:51 AM
Hi Everybody,

Here is a strange one for you....

I my app, I create a menu ...

In the example below, I use a logical value to hide a menu choice if I don't want the user to have access to it ... so far so good.

function BuildMenu()
      MENU oMenu 

      MENUITEM "Exit"
      MENU
         MENUITEM "Exit Program" Action QuitApp()
      ENDMENU

      MENUITEM "Help" WHEN lHelp       //This is where the issue is
      MENU
         MENUITEM "View Help File"  ACTION ViewHelp()
      ENDMENU

   ENDMENU
return oMenu



Now here is the strange part.....

Lets say lHelp := .t.

If I do a oMenu:Disable() only the menu items that do NOT have the WHEN clause will be disabled.

Why does this happen?


Thanks,
Jeff
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: oMenu:Disable()
Posted: Sat Mar 17, 2007 08:42 AM

It seems that WHEN clause has greater priority than Disable() method.

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
oMenu:Disable()
Posted: Sat Mar 17, 2007 02:21 PM

Jeff,

>In the example below, I use a logical value to hide a menu choice if I don't want the user to have access to it ... so far so good.

I think it is better to just not to add those items to the menu. I just check user rights when building the menu and leave out those items.

If the items are visible and disabled, the user is left to figure out why they are disabled. They wonder if they will become enabled after some user action, or if they need to configure something. Or, if they do know why the items are disabled, it is like an in-your-face statement that they are not good enough to have access.

If the items aren't on the menu, then both of these issues are solved. This might also solve your other problem.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
oMenu:Disable()
Posted: Sat Mar 17, 2007 04:27 PM

Hi James,

I can see what you are saying and it makes perfect sense, but in this case, having the user "see" what they are missing is a good thing ... additional options that are available to purchase :wink:

Jeff

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
oMenu:Disable()
Posted: Sat Mar 17, 2007 04:50 PM

Jeff,

>I can see what you are saying and it makes perfect sense, but in this case, having the user "see" what they are missing is a good thing ... additional options that are available to purchase.

Ah, a very good point indeed!

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion