On the fly hiding of MenuItems from Menubuttons.

Remco_Reinking
Member Posts: 74
In stead of making two menu buttons that are placed on top of each other and depending on some conditions wich one should be visible and thereby offering the user other menu items there is an other way to do this.
The property PushAction together with InvalidActionAppearance will do the trick.
See sample code form for the "how to"
This only works when the "normal Lookup behaviour" is not needed.
The property PushAction together with InvalidActionAppearance will do the trick.
See sample code form for the "how to"
This only works when the "normal Lookup behaviour" is not needed.
OBJECT Form 99998 TestFormpje { OBJECT-PROPERTIES { Date=17-09-10; Time=10:03:18; Modified=Yes; Version List=; } PROPERTIES { Width=8030; Height=3740; LookupMode=Yes; OnOpenForm=BEGIN SomeCondition := CONFIRM('With the extra menuItem?'); CurrForm.LOOKUPMODE := SomeCondition; END; OnQueryCloseForm=BEGIN IF MenuBtnPushed THEN // Dont close the form. BEGIN MenuBtnPushed := FALSE; EXIT( FALSE); END; END; } CONTROLS { { 1000000000;MenuButton;5610;2860;2200;550 ;CaptionML=NLD=&Functies; Menu=MENUITEMS { { ID=1000000018; CaptionML=NLD=Switch visibility; OnPush=BEGIN SomeCondition := NOT SomeCondition; CurrForm.LOOKUPMODE := SomeCondition; END; } { ID=1000000019; PushAction=LookupOK; InvalidActionAppearance=Hide; CaptionML=NLD=Visible on Condition; OnPush=BEGIN MenuBtnPushed := TRUE; DoWhatYouWantToDoAtThisPlace; END; } } } { 1000000020;CommandButton;770;2860;2200;550;HorzGlue=Right; VertGlue=Bottom; Default=Yes; PushAction=LookupOK; InvalidActionAppearance=Hide } { 1000000021;CommandButton;3190;2860;2200;550; HorzGlue=Right; VertGlue=Bottom; Cancel=Yes; PushAction=LookupCancel; InvalidActionAppearance=Hide } } CODE { VAR MenuBtnPushed@1000000000 : Boolean; SomeCondition@1000000001 : Boolean; PROCEDURE DoWhatYouWantToDoAtThisPlace@1000000000(); BEGIN // BigFunction here... MESSAGE('Did something.'); END; BEGIN END. } }
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions