This discussion is archived
12 Replies Latest reply: Jan 30, 2013 7:53 AM by HamidHelal RSS

Do a condition on alert

982158 Newbie
Currently Being Moderated
Hi,
I want to make a condition on an alert.
I have an alert named "imposed" I want to do a test when this alert is displayed example:
if //alerte "impo" is displayed then
//treatment 1
else
//treatment 2
end if;

is it possible ?
  • 1. Re: Do a condition on alert
    CraigB Guru
    Currently Being Moderated
    Does your Alert display a single button or do you display up to 3 choices buttons? For example, an Alert can display up to 3 buttons such as "Yes", "No", "Cancel". Do you want to take different actions depending on the button selected?

    I ask, because - you know (in your code) when your "Impose" alert is displayed because you have to explicitly display it using the Show_Alert() built-in. This being the case - you really can't do any conditional check to see if the Alert has been displayed because, as I said, you already know it was displayed. Make sense?

    Craig...
  • 2. Re: Do a condition on alert
    982158 Newbie
    Currently Being Moderated
    Yes i know ,the alert have only one button "ok" ,i want when the alert is displayed ,the item will be invisible ,so its not possible :(
    I have a second problem:
    I have 2 items (required belonging to a block-based), I have a button called "home", I want when I click on this button another form is displayed but the cursor is still on the first item (its since the item is required), so there's there a solution that allows me to solve problem ?
  • 3. Re: Do a condition on alert
    CraigB Guru
    Currently Being Moderated
    ...i want when the alert is displayed ,the item will be invisible ,so its not possible
    Sure, it is possible, but you are going to have to code it yourself. For example:
    ...your other logic here...
       --Now display Alert Imposed...
       Set_Item_Property('YOUR_BLOCK.ITEM',VISIBLE, PROPERTY_FALSE);
       Synchronize;
       Show_Alert('IMPOSED');
    ...the rest of your logic here...
    Keep in mind that setting an item to Visible=false has side-affects. When Visible is set to FALSE, the Enabled and Navigation properties are also set to FALSE. This means when you set the item Visible = TRUE you have to set Enabled and Navigation = TRUE as well; this is not automatic.
    I have 2 items (required belonging to a block-based), I have a button called "home", I want when I click on this button another form is displayed but the cursor is still on the first item (its since the item is required), so there's there a solution that allows me to solve problem ?
    Try using the Module/Form level property Defer Required Enforcement. Open the Object Navigator and click on this property and then press F1 to see what happens when you use "No", "Yes" or "4.5" property values.

    Craig...
  • 4. Re: Do a condition on alert
    982158 Newbie
    Currently Being Moderated
    Thank you for your help,
    But I don't know how to use this property " Defer Required Enforcement" :3
  • 5. Re: Do a condition on alert
    HamidHelal Guru
    Currently Being Moderated
    979155 wrote:
    Thank you for your help,
    But I don't know how to use this property " Defer Required Enforcement" :3
    It's form property. Click your form module and go to property and search for Defer Required Enforcement
    set it to yes

    Hope this helps
  • 6. Re: Do a condition on alert
    HamidHelal Guru
    Currently Being Moderated
    CraigB wrote:
    ...i want when the alert is displayed ,the item will be invisible ,so its not possible
    Sure, it is possible, but you are going to have to code it yourself. For example:
    ...your other logic here...
    --Now display Alert Imposed...
    Set_Item_Property('YOUR_BLOCK.ITEM',VISIBLE, PROPERTY_FALSE);
    Synchronize;
    Show_Alert('IMPOSED');
    ...the rest of your logic here...
    Hi Craig,
    If you try to set calling item to visible false you will get error. if you go other way, mouse focus will lost.

    Hamid
  • 7. Re: Do a condition on alert
    982158 Newbie
    Currently Being Moderated
    I have changed to "yes" but the problem persists and "4.5" same
  • 8. Re: Do a condition on alert
    Gurujothi Explorer
    Currently Being Moderated
    Hi,

    Actually based on some condition we are calling and displaying the alert right?
    I hope you are calling like this,
    Declare
    V_ALERT_NO      NUMBER  := 0;
    Begin
    <any condition> 
    set_alert_property('YOUR_ALERT_NAME',ALERT_MESSAGE_TEXT,
     ' Your alert message');
       V_ALERT_NO := show_alert('YOUR_ALERT_NAME');
    --Now the alert will be displayed,
    --so put your code here what you want to do when the alert displayed
    Regards,
    Guru.

    Edited by: Gurujothi on 30 Jan, 2013 11:33 AM
  • 9. Re: Do a condition on alert
    CraigB Guru
    Currently Being Moderated
    Hi Craig,
    If you try to set calling item to visible false you will get error. if you go other way, mouse focus will lost.

    Hamid >
    Really? What error? Are trying to set the property of an item that has focus? If so, yes you will get an error. The OP did not specify that he/she was setting the visible property of the current item, just that there was an item he/she wanted to make invisible.
    ...i want when the alert is displayed ,the item will be invisible...
    @ 979155,
    I have changed to "yes" but the problem persists and "4.5" same
    I wasn't positive the Defer Required Enforcement property would work and I didn't have the time to ceate a test case (sorry). This being the case, you can move your Required enforcement from the item property to the Key-Commit trigger and test your two required fields for NOT NULL values. Keep in mind, depending on how you call your second form, a Commit in the called form could also commit the record in the calling form.

    Craig...
  • 10. Re: Do a condition on alert
    HamidHelal Guru
    Currently Being Moderated
    CraigB wrote:
    Hi Craig,
    If you try to set calling item to visible false you will get error. if you go other way, mouse focus will lost.

    Hamid >
    Really? What error? Are trying to set the property of an item that has focus? If so, yes you will get an error. The OP did not specify that he/she was setting the visible property of the current item, just that there was an item he/she wanted to make invisible.
    Dear Craig,
    No error message displayed but mouse focus gone. The scenario is..
    you have 2 three image item named A and B in Content Canvas named "ABC". When you click on Image item A, image item B is shown in content canvas.
    Now clicking on image item B code is
    show_view('a_stack_canvas');
    go_item('stack_canvas.a_item');
    means focus will go to a_item of stack_canvas block. but When-New-Block-Instance trigger is present at stack_canvas block and code is
    set_item_property('B',visible,property_false);
    Now where is the cursor ? it's aren't blink anywhere in the form.

    THis the fact.

    Hamid
  • 11. Re: Do a condition on alert
    CraigB Guru
    Currently Being Moderated
    Hamid,
    Please post your own thread for this rather than usurp someone else's. Cursor focus issues are a known bug in certain Java versions. In your own thread, please let us know what your Forms, Java, and browser versions.

    Craig...
  • 12. Re: Do a condition on alert
    HamidHelal Guru
    Currently Being Moderated
    CraigB wrote:
    Hamid,
    Please post your own thread for this rather than usurp someone else's. Cursor focus issues are a known bug in certain Java versions. In your own thread, please let us know what your Forms, Java, and browser versions.
    Dear Craig...
    Yes. I know that, I've no intention to hijack someone thread. i'm not looking for solution. it's just an information.

    Thanks..

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points