Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

how to hide a menu item, having its name in string variable ?

3 posts in General Discussion (Chinese) Last posting was on 2009-09-02 16:47:15.0Z
Ahmed A. Posted on 2009-07-16 10:01:46.0Z
Sender: 613d.4a5ef678.1804289383@sybase.com
From: Ahmed A.
Newsgroups: sybase.public.chinese.powerbuilder.general
Subject: how to hide a menu item, having its name in string variable ?
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4a5efa8a.6437.1681692777@sybase.com>
NNTP-Posting-Host: forums-3-dub.sybase.com
X-Original-NNTP-Posting-Host: forums-3-dub.sybase.com
Date: 16 Jul 2009 03:01:46 -0700
X-Trace: forums-3-dub.sybase.com 1247738506 10.22.241.188 (16 Jul 2009 03:01:46 -0700)
X-Original-Trace: 16 Jul 2009 03:01:46 -0700, forums-3-dub.sybase.com
Lines: 2
Path: forums-1-dub!forums-master!forums-3-dub.sybase.com!not-for-mail
Xref: forums-1-dub sybase.public.chinese.powerbuilder.general:477
Article PK: 104501

Having a menu item name in string variable (vmenuname), how
to make that menu item invisible in script ?


David Posted on 2009-09-02 16:29:30.0Z
Sender: 584b.4a9e9497.1804289383@sybase.com
From: David
Newsgroups: sybase.public.chinese.powerbuilder.general
Subject: Re: how to hide a menu item, having its name in string variable ?
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4a9e9d69.599a.1681692777@sybase.com>
References: <4a5efa8a.6437.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 2 Sep 2009 09:29:30 -0700
X-Trace: forums-1-dub 1251908970 10.22.241.41 (2 Sep 2009 09:29:30 -0700)
X-Original-Trace: 2 Sep 2009 09:29:30 -0700, 10.22.241.41
Lines: 10
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.chinese.powerbuilder.general:489
Article PK: 104513


> Having a menu item name in string variable (vmenuname),
> how to make that menu item invisible in script ?

First get the reference to your menu associated to your
current window, then script like that (in event Open of your
window for example) :

menu lm_menu
lm_menu = this.menuid
lm_menu.m_file.m_open.visible = false


David Posted on 2009-09-02 16:47:15.0Z
Sender: 584b.4a9e9497.1804289383@sybase.com
From: David
Newsgroups: sybase.public.chinese.powerbuilder.general
Subject: Re: how to hide a menu item, having its name in string variable ?
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4a9ea193.5a08.1681692777@sybase.com>
References: <4a9e9d69.599a.1681692777@sybase.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 2 Sep 2009 09:47:15 -0700
X-Trace: forums-1-dub 1251910035 10.22.241.41 (2 Sep 2009 09:47:15 -0700)
X-Original-Trace: 2 Sep 2009 09:47:15 -0700, 10.22.241.41
Lines: 64
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.chinese.powerbuilder.general:490
Article PK: 104514


> > Having a menu item name in string variable (vmenuname),
> > how to make that menu item invisible in script ?
>
> First get the reference to your menu associated to your
> current window, then script like that (in event Open of
> your window for example) :
>
> menu lm_menu
> lm_menu = this.menuid
> lm_menu.m_file.m_open.visible = false

Sorry, I haven't noticed that you have only the name of you
menu item. If this item is not fix, you must create a
recurse function with loop on all items of your menu to
compare to the classname of the item that you search and
then to get its reference. Maybe there is a solution to get
reference of an item with its classname but i didn't find.
Here is a solution i found to my problem (must be modified
to be adapted for your problem) :

// __________________________________________________
// Objet : f_recurs_menu_droit
// Parameters : String as_nom_menu, String am_menu
// __________________________________________________


integer li_nbitem,li_item,li_ret, li_droit
string ls_item, ls_find
long ll_found
menu lm_menu

li_nbitem = upperbound(am_menu.item)
for li_item = 1 to li_nbitem
ls_item = left(am_menu.item[li_item].classname(),50)
// recherche de l'item dans la table de paramétrage
// le filtre sur le menu est deja effectué a l'appel de
la fonction
// on recherche donc uniquement par le libellé de l'item
de menu
//ls_find = "menu = '" + as_nom_menu + "' and item =
'" + ls_item + "'"
ls_find = "item = '" + ls_item + "'"
ll_found = gu_menu_droit.Find(ls_find, 1,
gu_menu_droit.il_nbrow)
if ll_found > 0 then
li_droit = gu_menu_droit.getitemnumber(ll_found,
"droit")
choose case li_droit
case 0
// rendre invisible le menu
am_menu.item[li_item].visible = false
// rendre invisible le toolbar
lm_menu = am_menu.item[li_item]
if lm_menu.toolbaritemname <> "" then
lm_menu.toolbaritemvisible = false
end if
case 1
// rendre disabled
am_menu.item[li_item].enabled = false
end choose
end if
// appel récursif
f_recurs_menu_droit(as_nom_menu, am_menu.item[li_item])
next