Keeping a commandbutton DIM when form is loaded

Author: lalitpct@gmail.com (lalitpct)

kept a button DIM while page loading, but when I retrieve some record it becomes enabled. Where is the ideal position for Fieldsyntax <button name>,dim to make it conssistent throught the session , Irrespective of what even user does. (note : I need to enable it in some sceario thats why we have that button)

9 Comments

  1. Hi Lalit, if you are really after page is LOADED the single best home is the INIT operation of the component. AFAIK, this works always but not if you start the page using "run Mypage" then it should be in the EXEC trigger. But whats about using DIM as a standard layout and change it to visible only in context with the retrieve?


    Author: ulrich-merkel (ulrichmerkel@web.de)
  2. "Use the $fieldsyntax function to set or retrieve dynamic syntax attributes of Field for the currently active occurrence.When setting the field syntax, if AttributeList contains an empty string, the syntax of Field is reset. The structure editor function ^CLEAR also resets the field syntax. Since the structure editor function ^RETRIEVE carries out an implicit ^CLEAR, this also resets field syntax."

    Hi,

    the problem is probably that Clear and Retrieve resets the field syntax, as you then gets a "new" occurrence. If I understand your question right, you will probably have to put the fieldsyntax in Execute (or Init) and furthermore last in Clear- and Retrieve-triggers (ie. always as you do a clear or retrieve).

    I have asked the same question in some older forum...

    Regards Rogerw.

     


    Author: rogerw (roger.wallin@abilita.fi)
  3. Unfortunately you cannot overrule a DIM that has been declared in the Field Syntax... When your button is in an entity, you could make a small local proc that sets the button to either dimmed or not, based on the business rules. Call that local proc from the Read and Occurrence Gets Focus trigger. I think these triggers will cover all situations.


    Author: Theo Neeskens (tneeskens@itblockz.nl)
  4. ulrich-merkel said Hi Lalit, if you are really after page is LOADED the single best home is the INIT operation of the component. AFAIK, this works always but not if you start the page using "run Mypage" then it should be in the EXEC trigger. But whats about using DIM as a standard layout and change it to visible only in context with the retrieve?

    Hi Ulrich, Thanks , I have tried that and seems ok. In Existing screen by default button is enabled , For some reason need to disable it after checking a parameter. For majority It shd be enabled so Thought better to put other way and added code in EXEC to disable. But after record retrieval it was automaticaly getting enabled , So was unsure which are the proc/triggers where I should put the code. Now Added in READ and EXEC, and seems to be covering everything. Thanks a ton for your quick response.


    Author: lalitpct (lalitpct@gmail.com)
  5. rogerw said

    "Use the $fieldsyntax function to set or retrieve dynamic syntax attributes of Field for the currently active occurrence.When setting the field syntax, if AttributeList contains an empty string, the syntax of Field is reset. The structure editor function ^CLEAR also resets the field syntax. Since the structure editor function ^RETRIEVE carries out an implicit ^CLEAR, this also resets field syntax."

    Hi,

    the problem is probably that Clear and Retrieve resets the field syntax, as you then gets a "new" occurrence. If I understand your question right, you will probably have to put the fieldsyntax in Execute (or Init) and furthermore last in Clear- and Retrieve-triggers (ie. always as you do a clear or retrieve).

    I have asked the same question in some older forum...

    Regards Rogerw.

     

    Yes , I am able to confirm what you said . Thanks


    Author: lalitpct (lalitpct@gmail.com)
  6. lalitpct said
    ulrich-merkel said Hi Lalit, if you are really after page is LOADED the single best home is the INIT operation of the component. AFAIK, this works always but not if you start the page using "run Mypage" then it should be in the EXEC trigger. But whats about using DIM as a standard layout and change it to visible only in context with the retrieve?
    Hi Ulrich, Thanks , I have tried that and seems ok. In Existing screen by default button is enabled , For some reason need to disable it after checking a parameter. For majority It shd be enabled so Thought better to put other way and added code in EXEC to disable. But after record retrieval it was automaticaly getting enabled , So was unsure which are the proc/triggers where I should put the code. Now Added in READ and EXEC, and seems to be covering everything. Thanks a ton for your quick response.

    Thanks

    Theo Neeskens said Unfortunately you cannot overrule a DIM that has been declared in the Field Syntax... When your button is in an entity, you could make a small local proc that sets the button to either dimmed or not, based on the business rules. Call that local proc from the Read and Occurrence Gets Focus trigger. I think these triggers will cover all situations.

    Noted Thanks for quick help .


    Author: lalitpct (lalitpct@gmail.com)
  7. Hi Lalit, as Theo stated, we can not overrule a "DIM" stated as field syntax. But what about using "HID" rather than "DIM": The button does not show up at all unless you ecide to undisclose it with: $fieldsyntax("X_BUTTON") = "YED,YPR,YDI" Minimal overhead in trigger coding = a better way of doing ist. Greetings from Frankfurt/Germany, Uli


    Author: ulrich-merkel (ulrichmerkel@web.de)
  8. ulrich-merkel said Hi Lalit, as Theo stated, we can not overrule a "DIM" stated as field syntax. But what about using "HID" rather than "DIM": The button does not show up at all unless you ecide to undisclose it with: $fieldsyntax("X_BUTTON") = "YED,YPR,YDI" Minimal overhead in trigger coding = a better way of doing ist. Greetings from Frankfurt/Germany, Uli

    Ok will try this as it sounds better before that sorry I got another question. I kept the button dim in a screen but when some other button is clicked a new screen comes up and in the original screen button which I made dim becomes active, I added the dim code in form gets focus and form loses focus but seems it doesn't work .


    Author: lalitpct (lalitpct@gmail.com)
  9. Even when I HID the button after clicking other button cursor goes to new screen. However in the original screen the button appears. where the code needs to be added so that in the original screen it doesnt comeback.


    Author: lalitpct (lalitpct@gmail.com)