For Programmers: Free Programming Magazines  


Home > Archive > PowerBuilder > August 2006 > Dynamically Disabling Menus from string variables









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Dynamically Disabling Menus from string variables
kscatlett@gmail.com

2006-07-27, 7:01 pm

I am trying to read in menu item names from a table into a string array
and then using the string array to Dynamically Disable the menu item if
the user does not have access to the corresponding window being calle
from the menu item. My problem is associating the string name of the
menu item to the actual menu item to use in dot notation.

Ex:
String ls_array[]
m_menu lm_menu

lm_menu = this.menuid

Cursor selecting menu item names into ls_array

Security function checking window_access()

If access = False then
lm_menu.ls_array[ll_count].Enabled = False
// This is what I want to accomplish but cannot translate the string
array name to an
// actual menu item type.
End If


I have tried all types of conversions and assignments but nothing is
working.
I am getting the following error message:
Incompatible property ls_array for type m_menu

If there is a way to accomplish this please let me know.

Thank you
Scott

Bad A$$ B-Rock

2006-08-17, 7:01 pm

Hi,

Not sure what kind of security checking you are doing in order to
determine if the menu is enabled or not. If it is based on a user id or
a group for example...you should use the PFC security that is
associated. Easy to maintain(using the PFC Security application) and
one line of code is all that is required in order to enable this
functionality.

However, if the security checking you are doing is of some other sort,
I think the only way you can really do that dynamically enough, is to
set boolean values for each menu option and then enable disable the
menu based on that. Using a string array to name a menu, can't be
done..they are completely different "data" types.

Hope this helps.

If you do find a way to do what you are doing, i'd like to know! lol

Brian
kscatlett@gmail.com wrote:
> I am trying to read in menu item names from a table into a string array
> and then using the string array to Dynamically Disable the menu item if
> the user does not have access to the corresponding window being calle
> from the menu item. My problem is associating the string name of the
> menu item to the actual menu item to use in dot notation.
>
> Ex:
> String ls_array[]
> m_menu lm_menu
>
> lm_menu = this.menuid
>
> Cursor selecting menu item names into ls_array
>
> Security function checking window_access()
>
> If access = False then
> lm_menu.ls_array[ll_count].Enabled = False
> // This is what I want to accomplish but cannot translate the string
> array name to an
> // actual menu item type.
> End If
>
>
> I have tried all types of conversions and assignments but nothing is
> working.
> I am getting the following error message:
> Incompatible property ls_array for type m_menu
>
> If there is a way to accomplish this please let me know.
>
> Thank you
> Scott


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com