Alpha Video Training
Results 1 to 7 of 7

Thread: Closing Xdialog Box

  1. #1
    Member
    Real Name
    Jon
    Join Date
    Jan 2009
    Posts
    343

    Default Closing Xdialog Box

    Having a difficult time "Closing" the Xdialog box when user presses the "Cancel" button. When pressed, the cancel button should close the Xdialog box but it is executing the script just like the "Send Report" button is. Thank you in advance for your help.

    Xdialog Code:

    DIM form_name as C
    if is_object(topparent.this) then
    form_name = topparent.name()+".this"
    else
    form_name = ""
    end if
    DIM vcTo as C
    DIM vcCC as C
    DIM vcSubject as C
    DIM vcMessage as C
    DIM vcAttachments as C
    DIM vcResult as C

    DELETE expression_result
    expression_result = eval("\"Sales Report For: \"+alltrim(Company.value) + (\" - \") +alltrim(Office.value)",form_name)
    vcSubject = convert_type(expression_result,"C")

    DELETE expression_result
    expression_result = eval("\"C:\Users\Kevin\Desktop\Current Sales Report.pdf\"",form_name)
    vcAttachments = convert_type(expression_result,"C")
    ok_button_label = "Send Report"
    cancel_button_label = "Cancel"
    vcResult = ui_dlg_box("Email - Current Sales Report",<<%dlg%
    {region}
    TO:| [.40vcTo];
    CC:| [.40vcCC];
    Subject:| [.65vcSubject];
    MESSAGE:| [%mw%.65,5vcMessage];
    ATTACHMENTS:| [.65vcAttachments];
    {endregion};
    {line=1,0};
    {region}
    <15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%)

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Closing Xdialog Box

    There is nothing in your xdialog that I see that sends a report and there is no Send Report button, per se. You have an Ok Button and a Cancel button with the OK button labeled Send Report.

    If you have code after the xdialog to send the report then likely you are not testing the value of vcresult to branch.

    if vcresult = "OK"
    'command to send the report
    else
    'do nothing
    end
    end if

    You could also do this after the xdialog.

    if vcresult = "Cancel"
    end
    end if

  3. #3
    Member
    Real Name
    Jon
    Join Date
    Jan 2009
    Posts
    343

    Default Re: Closing Xdialog Box

    Thanks Stan. Works as expected.

    How can I make the "big red X" in the upper right corner do the same as the "Cancel"? In other words, if the user presses "Red X" Xdialog box will close

  4. #4
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,617

    Default Re: Closing Xdialog Box

    {can_exit=cancel}
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  5. #5
    Member
    Real Name
    Jon
    Join Date
    Jan 2009
    Posts
    343

    Default Re: Closing Xdialog Box

    Thanks Al for the reply. Where would I place "{can_exit=cancel} ". Beginner here....

  6. #6
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,617

    Default Re: Closing Xdialog Box

    Start with the wiki can_exit
    Al Buchholz
    Bookwood Systems, LTD
    Weekly QReportBuilder Webinars Thursday 1 pm CST

    Occam's Razor - KISS
    Normalize till it hurts - De-normalize till it works.
    Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
    When we triage a problem it is much easier to read sample systems than to read a mind.

  7. #7
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Closing Xdialog Box

    There you go again, Al. Really? Check the documentation? You have high expectations.

Similar Threads

  1. How to detect when closing an XDialog with Red X
    By gkpurcey in forum Alpha Five Version 10 - Desktop Applications
    Replies: 14
    Last Post: 10-10-2011, 11:29 AM
  2. auto closing an xdialog box
    By martinwcole in forum Alpha Five Version 10 - Desktop Applications
    Replies: 4
    Last Post: 07-28-2011, 05:59 PM
  3. Stop xdialog with multiple dates from closing
    By Raymond Lyons in forum Alpha Five Version 7
    Replies: 2
    Last Post: 01-12-2007, 07:47 PM
  4. Xdialog - form closing problem
    By Tom Cone Jr in forum Alpha Five Version 6
    Replies: 1
    Last Post: 10-19-2004, 08:49 AM
  5. Closing Dialog Box
    By Ronald Anusiewicz in forum Alpha Five Version 5
    Replies: 4
    Last Post: 02-24-2004, 04:17 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •