disable menu button in form..........

nrapendra
nrapendra Member Posts: 208
hi..

i want to disable post button in purchase order through code.
what code should i write..





regards
Nrapendra Singh
(Sr. Tech. Consultant)
Dataman Computer Systems (P) Ltd.
web :www.datamannet.com
mail :nrapendra@datamannet.com

Answers

  • Arhontis
    Arhontis Member Posts: 667
    In case you want to disable the menu button itself then you go to the properties of the menu button, enter a specific name, and then in code you can:
    CurrForm.MyMenuButton.ENABLED(FALSE);
    

    I don't know any way of disabling just an option of a menu button from code...
  • NR
    NR Member Posts: 78
    To disable the Menu Option "Post" in the Menu Button "Posting", the property Enabled for the Menu Option "Post" can be set to No in design mode.

    Dynamically disabling the menu option is not possible. However,dynamically disabling the menu button is possible as shared by arhontis
  • NR
    NR Member Posts: 78
    To disable the Menu Option "Post" in the Menu Button "Posting", the property Enabled for the Menu Option "Post" can be set to No in design mode.

    Dynamically disabling the menu option is not possible. However,dynamically disabling the menu button is possible as stated by arhontis
  • Dennis_Decoene
    Dennis_Decoene Member Posts: 123
    nrapendra wrote:
    what code should i write..

    None ;) Can't be done
  • David_Singleton
    David_Singleton Member Posts: 5,479
    nrapendra wrote:
    hi..

    i want to disable post button in purchase order through code.
    what code should i write..

    regards

    This is a quite common request, and there are three solutions to it.

    1/ Expalin to the client that this is not a good idea, since its not the way Navision works, and instead suggest to them a work around. A common one being to generate an error message that prevents the user from continuing.
    This is my prefered solution, and I try very hard to have the customer work with this.

    2/ If there is only one Option that needs to be disabled (i.e. your case), then I would create two buttons, identical, buton one button I would disable the Post Invoice option. Then use code to show or hide the appropriate button as required. I have done this a few times, but it has one core issue, and that is that in many cases (where close = 100% of the time ](*,) ) the client will come back and say "brilliant, now can you also make these other 3 options selectable in code, i.e. 16 buttons needed). So if you go this route, tell the customer that in Navisions its absolutely impossible to do more than one option ( :^o a white lie I know but its for their own good), otherwise they will want it on every form.

    3/ If the client really does need more than one selectable option. A good example is a clinent that has 10 different versions of a sales order report, and they don't want the user prompted to select from 10, but just the 2 or 3 vaild for that order.
    Create a new report. In this report add code that opens a STRMENU dialog, and build the text string using a case based ont he valid selections. Then the user hits the button on the form which opens the option string, and they have dynamic selection as required. (By the way, I do it in a report, because ALLWAYS int he futre, the cleint wants to change it them selves, and a Codeunit would prevent this.
    David Singleton
  • Arhontis
    Arhontis Member Posts: 667
    Gr8 suggestion David! =D>

    How could I forget this? I have already perform such implementation by creating dynamic STRMENU when user login to pick default dimensions or branch, e.t.c.

    It is a very cool way and it can be expanded (with more values) without writting too much code or checks...
  • David_Singleton
    David_Singleton Member Posts: 5,479
    Arhontis wrote:
    Gr8 suggestion David! =D>

    How could I forget this? I have already perform such implementation by creating dynamic STRMENU when user login to pick default dimensions or branch, e.t.c.

    It is a very cool way and it can be expanded (with more values) without writting too much code or checks...

    Thanks ... hmm wheres the :blush: smily gone 8)
    David Singleton
  • nrapendra
    nrapendra Member Posts: 208
    hi..

    thanx to all for valuable support.
    actualy i have not illustrated the problem due to which i have to modify it.
    it is nothing but a simple check on purchase order.
    client want that the until posting authority dont write the descriptive
    reason for order he will not be able to post it.



    not it is solved.

    thanx again to all...
    Nrapendra Singh
    (Sr. Tech. Consultant)
    Dataman Computer Systems (P) Ltd.
    web :www.datamannet.com
    mail :nrapendra@datamannet.com