show/hide control on the form at the run-time

I wanna dynamicly(at run time) show/hide control on the form. Related to simple control type, like buttons its work fine – code some like this: OnOpenForm() IF(Variable_1 = TRUE) THEN CurrForm.MyButton.VISIBLE := TRUE ELSE CurrForm. MyButton.VISIBLE := FALSE; It’s forks fine, BUT if I wanna show/hide menu items on-runtime, but I can access to the Menu button nor menu item: CurrForm.MyMenuButton.VISIBLE := true; <-------------------- OK CurrForm. MyMenuButton.MenuItem1.VISIBLE := true; <--------- Not WORK !!! What shell I do?

Most User Interface guides will advise you against dynamically showing/hiding controls, since most users generally expect a control to be present, no matter what the circumstances are. Most applications choose to disable unavailable functions instead. Navision’s policy has always been to leave all controls enabled, and display an error message should a user select a function that is not available at the time. Although I can see the obvious advantages of your approach, I’d advise you to stick to the Navision policy. Furthermore, as far as I know, menu-items cannot be hidden/shown dynamically, nor can they be disabled… Kind regards, Jan Hoek Weha Automatisering BV The Netherlands P.S.: Please consider the following snippet (which I believe is more “elegant”). CurrForm. MyButton.VISIBLE := Variable_1; instead of IF(Variable_1 = TRUE) THEN CurrForm.MyButton.VISIBLE := TRUE ELSE CurrForm. MyButton.VISIBLE := FALSE;

quote:


Most User Interface guides will advise you against dynamically showing/hiding controls,


Therefore …


CurrForm.MyButton.**ENABLED** := Variable_1;

------- With best regards from Switzerland Marcus Fabian Edited by - fabian on 2001 Sep 12 18:33:33

I’ll not debate whether or not to hide/disable the controls. However, if you are attempting to disable individual menu items on a menu button, I don’t believe that can be done. Insted, try creating 2 (or more) menu buttons matching the desired functions allowed. Then create a case statement to toggle the menu buttons visible or not. Bill Benefiel Manager of Information Systems Overhead Door Company billb@ohdindy.com (317) 842-7444 ext 117

Unfortunately you are right. You cannot access menu controls. ------- With best regards from Switzerland Marcus Fabian

This is actually a common prolem, I don’t think that sub menu options should be hidden, but enabled makes sense. Anyway, I can’t answer your problem, but heres a tip. If you make the source expression of a sub menu item a boolean, then the sub menu will display a 'tick" if the boolean is true. Somethimes I have been able to use this as a work around.

By the way here is the code: OBJECT Table 27 Item {OBJECT-PROPERTIES PROPERTIES FIELDS { { 1 ; ;No. ;Code20 ;deleted code here… } { 2 ; ;No. 2 ;Code20 } { 70000; ;Test ;Boolean } OBJECT Form 30 Item Card { OBJECT-PROPERTIES PROPERTIES CONTROLS { 103 ;MenuButton ;6490 ;6710 ;2200 ;550 ;HorzGlue=Right; VertGlue=Bottom; CaptionML=ENU=&Item; Menu=MENUITEMS { {more options in here…} { ID=124; CaptionML=ENU=Test; SourceExpr=Test; OnPush=BEGIN Test := NOT Test; MODIFY; END;